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 in lib/src/sub-project-2/index.d.ts refers to root/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
TypeScript Version: 3.6.0-dev.20190531, 3.5.1
Search Terms: composite projects, declaration files, paths
Code
npm installnpm run buildcat lib/src/sub-project-2/index.d.tscat lib-non-composite/src/sub-project-2/index.d.tsfile from composite output (./lib):
file from non-composite output (./lib-non-composite):
There we have 2 things:
../../lib/src/common/nominalinlib/src/sub-project-2/index.d.tsrefers toroot/lib/lib/src/common/nominal, but this file does not exist - there should be../../../, not../..). Output from non-composite project has valid path.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