Add TypeScript definitions
See original GitHub issueI’m using imagemin-webpack
in my webpack configuration, and it would be nice to have type definitions for this loader.
This is fairly easy to add:
- Run
npm install --save-dev typescript
. - Create a
tsconfig.json
file like:{ "compilerOptions": { "target": "ES5", "outDir": "types", "newLine": "LF", "allowJs": true, "declaration": true, "emitDeclarationOnly": true }, "include": [ "index.js", "src/**/*" ], "compileOnSave": false }
- Add
"types": "types/index.d.ts"
topackage.json
. - Run
npx tsc
to generate the declaration files.
(optional: Add an npm script and add some JSDoc comments)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TypeScript: Adding Custom Type Definitions for Existing ...
The step-by-step process to get to that definition is started by adding a property that does exist, and going to the definitions of...
Read more >Documentation - Type Declarations - TypeScript
TypeScript automatically finds type definitions under node_modules/@types , so there's no other step needed to get these types available in your program.
Read more >Add your own Type Definition to any Javascript 3rd party module
1. To the typeRoots property add your local-types folder path. "compilerOptions" : { ... "typeRoots": [ "node_modules/@types", · 2. Add a paths ...
Read more >How to add custom types into the TypeScript project - drag13.io
Create custom typings · Create a root folder for your types. You can give any name for it but let it be types...
Read more >The repository for high quality TypeScript type definitions.
If you are adding typings for an npm package, create a directory with the same name. If the package you are adding typings...
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
Yep, good idea, it is on roadmap for all loaders/plugins, feel free to send a PR
You can get them from
ImageMinimizerPlugin
, i.e.ImageMinimizerPlugin['options']
, types some wrong right now