Insufficient type definitions for partial importing when using only specific version
codeflowee opened this issue · 2 comments
Describe the bug
When doing partial import type definitions does not recoqnise uuidv*
.
How to reproduce
For my project I am using Create React App.
Add uuid as dependency into project. At this point uuid
version 8.3.2
and @types/uuid
version 8.3.1
will be installed.
npm install uuid -E && npm install @types/uuid -D
Import only uuidv4
from CDN in index.html
.
<!-- With this we can run uuidv4() anywhere we want -->
<script src="https://cdn.jsdelivr.net/npm/uuid@8.3.2/dist/umd/uuidv4.min.js"></script>
Use uuidv4
in module for importing only specific version.
/**
* Need to add these ignore blocks in front of import for making it work
*/
// @ts-ignore
// eslint-disable-next-line import/no-unresolved
import uuidv4 from 'uuid/v4';
/**
* This now works
*/
console.log(uuidv4());
As we have React App Rewired in project we have set configuration to map external packages so they are not included in build bundle, UMD versions of libraries will be used instead.
{
"uuid/v4": "uuidv4"
}
Expected behavior
Type definitions work correctly if importing only specific version.
Runtime
- OS: any
- Runtime: any
- Runtime Version: any
Marking as stale due to 90 days with no activity.
Sorry for not getting to this earlier!
This package doesn't ship with any typings of its own, so you'll need to open an issue in the DefinitelyTyped repo.