spencermountain / spacetime

A lightweight javascript timezone library
http://spacetime.how/
Other
3.97k stars 185 forks source link

[Typescript] Could not find declaration file for module 'spacetime' #356

Closed abetoots closed 12 months ago

abetoots commented 1 year ago

Could not find declaration file for module 'spacetime' when using moduleResolution: 'NodeNext' or "Node16".

TS version: 4.9.3 Spacetime version: 7.2.0

spencermountain commented 1 year ago

hey Abe, I may need more information about your build setup. I'm afraid i'm not very sharp at typescript details. From what I understand, the typefile is linked in spacetime properly. let me know if you have any suggestions cheers

the-sky-is-pink commented 1 year ago

Hey , is there any solution for this ?

folkg commented 1 year ago

I'm having the same issue. I solved it with a workaround.

I created a spacetime.d.ts in my src directory, and I simply added this line:

declare module "spacetime";

spencermountain commented 1 year ago

hey @jecraig - you know anything about nodeNext? happy to make any changes, would love some help.

jecraig commented 1 year ago

I don't know of any issues, but I'll take a look

jecraig commented 1 year ago

@spencermountain Ok, so I don't have a fix for this, but it looks like it's just an issue with our package.json. Here's a demo that reproduces the issue.

https://github.com/jecraig/Spacetime356Test

I changed the package.json to this and it worked for the project, but your rollup failed to run.

{ "name": "spacetime", "version": "7.4.4", "description": "figure-out dates across timezones", "unpkg": "builds/spacetime.min.js", "main": "src/index.js", "module": "./src/index.js", "es2015": "./src/index.js", "types": "types/index.d.ts", "sideEffects": false, "exports": { ".": { "types": "./types/index.d.ts", "require": "./builds/spacetime.cjs", "default": "./src/index.js" } }

I'll try playing with it more after the weekend, but this is what I've discovered so far.

spencermountain commented 12 months ago

should be fixed now in 7.4.5 - let me know if you see any other funny business. cheers