Closed h-h-h-h closed 9 months ago
There's something strange going on, because, right after posting, the file from my last sentence stopped working with IteratorResult
complained about.
I forgot to run npm install typescript --save-dev
(oops). Still:
typescript
npm package contains IteratorResult
../node_modules/temporal-polyfill/dist/global.d.ts
isn't complained about, but Temporal
still isn't available and wavily underlined, and its children on their own like ZonedDateTime
are provided by intellisense (with source stated on the right of the box as "temporal-polyfill"), but wavily underlined with error "Cannot find name 'ZonedDateTime'. ts(2304)".Hi @h-h-h-h , this is happening because you have an old lib
in your tsconfig. You can try adding lib: ['ES2020']
or add the Intl lib only like this.
It might actually be fixed in the most recent version (0.2.0) even without edits to lib
because the typescript definitions access it in a possibly-safer way (globalThis.Intl.DateTimeFormatPart
which might fallback to undefined). Would you mind giving 0.2.0 a spin?
Thank you, but I'm currently not working in the ecosystem anymore.
I'm just getting started with TypeScript and try to migrate a test project in VS Code to it.
I import this polyfill globally only in the entry point file with:
Then, in other files,
Temporal
is unavailable. So, I tried thistsconfig.json
:Temporal
is still unavailable and, forglobal.d.ts
, this error is shown:Also: Surely, it's not recommended to link to a file in
node_modules
. How is it done properly?When I use this definition file in
tsconfig.json
instead, it works.