-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Description
TypeScript Version: 3.6.0-dev.20190531, 3.5.1
Search Terms: composite projects, declaration files, paths
Code
- Download zip with the project project.zip
npm install
npm run build
cat lib/src/sub-project-2/index.d.ts
cat lib-non-composite/src/sub-project-2/index.d.ts
- Compare these files. In my case it's:
file from composite output (./lib):
declare const variable: {
key: import("../../lib/src/common/nominal").Nominal<string, "MyNominal">;
};
export declare function getVar(): keyof typeof variable;
export {};
file from non-composite output (./lib-non-composite):
declare const variable: {
key: import("../common/nominal").Nominal<string, "MyNominal">;
};
export declare function getVar(): keyof typeof variable;
export {};
There we have 2 things:
- Output from build mode (composite project) has invalid import path (
../../lib/src/common/nominal
inlib/src/sub-project-2/index.d.ts
refers toroot/lib/lib/src/common/nominal
, but this file does not exist - there should be../../../
, not../..
). Output from non-composite project has valid path. - I don't know why, but the compiler adds
import()
and "inline" declaration instead of importing it from file where it declared for both composite and non-composite projects. Even if it works for non-composite project, it looks strange.
I'm not sure about 2, but the first looks like a bug because it produces invalid typings.
Related Issues: #25600
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript