awesome-typescript-loader icon indicating copy to clipboard operation
awesome-typescript-loader copied to clipboard

Exporting types results in incomplete d.ts output

Open quantuminformation opened this issue 7 years ago • 3 comments
trafficstars

In this library file I am Reexporting a type from vanilla-typescript so that the end user of solar-popup doesn't need to install vanilla-typescript.

However in the build folder I am missing several definiton files. screen shot 2018-04-04 at 12 57 29

Any ideas?

quantuminformation avatar Apr 04 '18 12:04 quantuminformation

Hmm, after looking at this it seems that exporting types is legal code, but doesn't produce any output in the d.ts

// When you have optional parts
export type OptionalDimensions = {
  width?: number,
  height?: number
}

I also found the same issue when not exporting an npm type, but rather a local one.

quantuminformation avatar Apr 04 '18 12:04 quantuminformation

I'm running into the same issue with awesome-typescript-loader 5.0.0.

type ITest = { themeId: string };

export { ITest};

results in no output with awesome-typescript-loader. Does emit a proper d.ts using ts-loader.

Thanks!

pachuka avatar Apr 09 '18 23:04 pachuka

I'd prefer not to use ts-loader as it behaves differently, eg if I replace my project with it I get this error which I don't with Awesome

ERROR in ./node_modules/vanilla-typescript/index.ts
Module build failed: Error: Typescript emitted no output for /Users/nikos/WebstormProjects/solar-popup/node_modules/vanilla-typescript/index.ts.
You should not need to recompile .ts files in node_modules.
Please contact the package author to advise them to use --declaration --outDir.
More https://github.com/Microsoft/TypeScript/issues/12358
    at successLoader (/Users/nikos/WebstormProjects/solar-popup/node_modules/ts-loader/dist/index.js:39:15)
    at Object.loader (/Users/nikos/WebstormProjects/solar-popup/node_modules/ts-loader/dist/index.js:21:12)
 @ ./src/SolarPopup.ts 2:0-46 73:34-42
 @ ./src/index.ts

quantuminformation avatar Apr 13 '18 11:04 quantuminformation