Closed
Description
π Search Terms
"specifier", "relative path"
π Version & Regression Information
- This changed between versions 5.4.0-dev.20231221 and 5.4.0-dev.20231222
- This changed in commit or PR Add auto-import for the
package.json
imports
fieldΒ #55015
β― Playground Link
https://github.com/xlianghang/ts-specifier-bug
π» Code
//src/main.ts
import { PartialType } from './utils';
class Common {}
export class Sub extends PartialType(Common) {
id: string;
}
// src/utils/index.ts
import { MyType, MyReturnType } from './type-helpers';
export function PartialType<T>(classRef: MyType<T>) {
abstract class PartialClassType {
constructor() {}
}
return PartialClassType as MyReturnType;
}
// src/utils/type-helpers.ts
export type MyReturnType = {
new (...args: any[]): any;
};
export interface MyType<T = any> extends Function {
new (...args: any[]): T;
}
π Actual behavior
The dist
folder is not the root directory, so do not import from src
π Expected behavior
Import from a relative path
Additional information about the issue
Compilation fails in the MacOS, but is expected to behave in the https://stackblitz.com/~/github.com/xlianghang/ts-specifier-bug
π» MacOS 14.3οΌApple M2 Max