Reputation: 3682
I'm using a module (dom-to-image
) that has Types (through Definitely Typed) but is unmantained, so I'm using a fork (called dom-to-image-more
) of it with a few more updates. However, the fork doesn't have types.
How can I tell TypeScript to use dom-to-image
's types but assign them to the other module? Since they're installed through @types/dom-to-image
TypeSript automatically assigns them to that module (if I understand how it works correctly, I may now).
I can shut TS from complaining by creating a .d.ts
file and adding declare module "dom-to-image-more";
. But I'd like to maintain the original Types.
A simple solution is to copy-paste the types from the module into my .d.ts
, but I'd prefer to reuse the original types.
Upvotes: 3
Views: 658
Reputation: 8340
You may try to install @types/dom-to-image
under alias @types/dom-to-image-more
:
yarn add -D @types/dom-to-image-more@npm:@types/dom-to-image
or
npm install --save-dev @types/dom-to-image-more@npm:@types/dom-to-image
In the package.json
file it will be:
"@types/dom-to-image-more": "npm:@types/dom-to-image"
And you can control versions as regular:
"@types/dom-to-image-more": "npm:@types/dom-to-image@^2.6.3"
Upvotes: 3