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

abbreviations isn't defined in the typescript definition file #255

Open
stkrzysiak opened this issue May 9, 2022 · 4 comments
Open

abbreviations isn't defined in the typescript definition file #255

stkrzysiak opened this issue May 9, 2022 · 4 comments

Comments

@stkrzysiak
Copy link

When running node version 14.x the lack of typescript definition causes an error, but this doesn't happen in node v16.x. Not sure exactly why but will PR the fix.

➜  node-vanilla node index.js                                                          
xxxxxx/node-vanilla/index.js:1
import { abbreviations } from '@vvo/tzdb';
         ^^^^^^^^^^^^^
SyntaxError: The requested module '@vvo/tzdb' does not provide an export named 'abbreviations'
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:92:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:107:20)
    at async Loader.import (internal/modules/esm/loader.js:179:24)
➜  node-vanilla nvm use v16.0.0
Now using node v16.0.0 (npm v7.10.0)
➜  node-vanilla node index.js  
ACT

index.js:

import { abbreviations } from '@vvo/tzdb';
console.log(abbreviations[Object.keys(abbreviations)[0]]);
@stkrzysiak
Copy link
Author

PR up, not sure why it didn't link up, build failing but vercel gives me a 404. #256

@BenceSzalai
Copy link

Hi! TypeScript TSC gives me TS2305: Module '"@vvo/tzdb"' has no exported member 'abbreviations'.

Is there a reason for the abbreviations to not be in index.d.ts? Or more precisely do we know why #256 is failing?

@stkrzysiak
Copy link
Author

I forgot about this issue entirely, can you provide me steps to reproduce what you're seeing @BenceSzalai

@BenceSzalai
Copy link

In my setup simply making a new TypeScript file anywhere with the following triggers the issue:

import { abbreviations } from '@vvo/tzdb'

Right now my workaround is to add a definition manually before the import like this:

declare module '@vvo/tzdb' {
  export const abbreviations: Record<string, string>
}

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

No branches or pull requests

2 participants