Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with ES6 imports and TypeScript #12

Closed
IGassmann opened this issue Aug 30, 2019 · 3 comments
Closed

Doesn't work with ES6 imports and TypeScript #12

IGassmann opened this issue Aug 30, 2019 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@IGassmann
Copy link

The following throws the compilation error 'MUUID' only refers to a type, but is being used as a value here.

import { MUUID } from 'uuid-mongodb';

const muuid = MUUID.from('393967e0-8de1-11e8-9eb6-529269fb1459');
@cdimascio cdimascio self-assigned this Sep 13, 2019
@cdimascio cdimascio added the bug Something isn't working label Sep 13, 2019
@cdimascio
Copy link
Owner

cdimascio commented Sep 13, 2019

To import MUUID with Typescript, you can do one of the following:

with no special Typescript config:

import * as MUUID from 'uuid-mongodb'

With Typescript's esModuleInterop
(set tsconfig.json compilerOptions.esModuleInterop: true)
and do the following

import MUUID from 'uuid-mongodb'

@cdimascio
Copy link
Owner

@IGassmann see above comment

@cdimascio cdimascio added question Further information is requested and removed bug Something isn't working labels Sep 13, 2019
@IGassmann
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants