Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Exporting types results in incomplete d.ts output #566

Open
quantuminformation opened this issue Apr 4, 2018 · 3 comments
Open

Exporting types results in incomplete d.ts output #566

quantuminformation opened this issue Apr 4, 2018 · 3 comments

Comments

@quantuminformation
Copy link

quantuminformation commented Apr 4, 2018

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
Copy link
Author

quantuminformation commented Apr 4, 2018

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 quantuminformation changed the title Re-exporting npm lib results in incomplete d.ts output Re-exporting npm lib type results in incomplete d.ts output Apr 4, 2018
@quantuminformation quantuminformation changed the title Re-exporting npm lib type results in incomplete d.ts output Exporting types results in incomplete d.ts output Apr 4, 2018
@pachuka
Copy link

pachuka commented Apr 9, 2018

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!

@quantuminformation
Copy link
Author

quantuminformation commented Apr 13, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants