Skip to content

Is this a bug with lerna multi package project with TS4053 error? #40718

@haha370104

Description

@haha370104

TypeScript Version: 4.0.3

Code

This is the repo of demo https://github.com/haha370104/lerna-typescript-error

These files just like this.

export const enum TestEnum {
    Test1 = '123123',
    Test2 = '12312312312',
}

export interface ITest {
    [TestEnum.Test1]: string;
    [TestEnum.Test2]: string;
}

export class A {
    getA(): ITest {
        return {
            [TestEnum.Test1]: '123',
            [TestEnum.Test2]: '123',
        };
    }
}
// packages/ts-error/src/index.ts

import {A} from './class';

export class B extends A {
    getA() { // TS4053 error
        return {
            ...super.getA(),
            a: '123',
        };
    }
}

Actual behavior:

The "getA" method of class B will cause an error as " error TS4053: Return type of public method from exported class has or is using name 'TestEnum' from external module "/Users/admin/lerna-test/packages/ts-error/src/class" but cannot be named". But if i move these two files to root director, the error will disappear.

I'm don't know why these two file will be recognized to be external module when they in the same lerna package. Also I'm not sure this is a ts issue or my mistake. But it has already cost days for me to search the answer but without result.

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions