Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Add .d.ts typings file #363

Merged
merged 4 commits into from Apr 3, 2019
Merged

Add .d.ts typings file #363

merged 4 commits into from Apr 3, 2019

Conversation

NotWoods
Copy link
Member

Adds a .d.ts TypeScript declaration file to support typechecking a Rollup config with TypeScript.

TypeScript allows for checking normal Javascript files by adding a // @ts-check comment at the top of the file. By providing typings users can check that they aren't passing misspelled or incorrect parameters, and see a hint about what each option does in their editor.

typings-demo-commonjs

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for letting this wait for so long. I would actually like to merge this one and I see you created some kind of test. Would it be possible to "run" this test as part of the test script? I assume you will want to add TypeScript as a dev dependency, which is definitely not a problem.

@NotWoods
Copy link
Member Author

NotWoods commented Apr 2, 2019

Yup, the type checking tests can be run automatically. I've added TypeScript and some minimal configuration to run the check.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, awesome!

@lukastaegert lukastaegert merged commit 79151ef into rollup:master Apr 3, 2019
@NotWoods NotWoods deleted the typings branch April 3, 2019 06:04
@nicolashenry
Copy link
Contributor

@lukastaegert The typing file does not exists in the package available on npm registry.
I think this part is missing in package.json file :

"files": [
    "dist/*.js",
    "dist/*.d.ts"
  ],

And maybe also :

 "typings": "index.d.ts",

@NotWoods
Copy link
Member Author

NotWoods commented Apr 3, 2019

Yeah, I didn't notice the files field. Adding "index.d.ts" to files will do the trick, the typings/types field is unnecessary because TypeScript will automatically find files named index.d.ts in the package root.

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

Successfully merging this pull request may close these issues.

None yet

3 participants