Why are interface declarations removed?
See original GitHub issueHi,
I’m trying to move from webpack to rollup for a library and I have trouble getting declarations to work correctly.
It seems that interfaces declarations aren’t exported, this is a problem when I have things like :
import { RenderedCell } from "../RenderedCell";
export default class MergedCell implements RenderedCell {
// ...
}
I get the error that RenderedCell can’t be found. I worked in webpack, and I can’t understand what’s the difference in my configuration that broke this. but I seem to understand that it’s normal with Rollup.
BTW. I’m using the latest rollup, rollup-plugin-typescript2 and rollup-plugin-uglify I can post my configurations if needed
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (9 by maintainers)
Top Results From Across the Web
In defense of interface: Using declaration merging to disable ...
TypeScript's interface has gotten a bit of a bad rap lately, largely because of declaration merging, a behavior of interface that's quite ...
Read more >Why can Dart's built-in List interface be instantiated?
Notice: This question is obsolete; the interface declaration syntax has been removed from Dart: Proposal to eliminate interface declarations ...
Read more >Defining an Interface (The Java™ Tutorials > Learning the ...
An interface declaration consists of modifiers, the keyword interface , the interface name, a comma-separated list of parent interfaces (if any), ...
Read more >Understanding and using interfaces in TypeScript
In the above example, we can define an interface for the Tesla Model ... in the interface with the one defined in the...
Read more >Handbook - Interfaces - TypeScript
To describe a function type with an interface, we give the interface a call signature. This is like a function declaration with only...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For what it’s worth, I just call
tsc --emitDeclarationOnly
after rollup, which overrides the declaration files into build folder. in my package.jsonYep, just checked, adding
import "./SomeInterface";
in the test repo fixes things.When importing types only, typescript elides import statements from js output and rollup doesn’t see those files and thus doesn’t send them for transpiling.
I’ll try to cheat and monitor which files typescript requested from disk vs which files rollup sent for transpiling. Should be possible to force-transpile the difference with definitions only flag. This might result in too many d.ts files in some cases I though (for things rollup has legitimately shaken from the tree for example)