tempus icon indicating copy to clipboard operation
tempus copied to clipboard

typescript support

Open ViNoS-ab opened this issue 2 years ago • 7 comments

I have this type error when i use Tempus.add : Property 'add' does not exist on type 'r'

adding // @ts-ignore does the trick but it's still good to have a type declaration

ViNoS-ab avatar Sep 17 '23 01:09 ViNoS-ab

I also get a typescript error when using this in a next.js 14 project.

Could not find a declaration file for module '@studio-freight/tempus'. '/Users/pixply/project/node_modules/@studio-freight/tempus/dist/tempus.modern.mjs' implicitly has an 'any' type.
  Try `npm i --save-dev @types/studio-freight__tempus` if it exists or add a new declaration (.d.ts) file containing `declare module '@studio-freight/tempus';`ts(7016)

adding

"types": "./dist/types/index.d.ts"

to package.json in "exports": {} would help...

https://github.com/studio-freight/tempus/blob/067bd998100e9c37be6462d3d996be742875cac7/package.json#L15-L18

pixply avatar Jan 04 '24 13:01 pixply

it should be fixed in v0.0.40

clementroche avatar Jan 04 '24 18:01 clementroche

I might not get it, but for me now the types directory and the index.d.ts file a completely gone... So I still get the typescript error in Next JS. Leaving these files and just adding the mentioned line to package.js would have done the trick, I think. And also the import is now broken, since the module is gone.

import Tempus from '@studio-freight/tempus';
Cannot find module '@studio-freight/tempus' or its corresponding type declarations

pixply avatar Jan 08 '24 18:01 pixply

mb @pixply, can you try v0.0.41 ?

clementroche avatar Jan 08 '24 19:01 clementroche

The same

I might not get it, but for me now the types directory and the index.d.ts file a completely gone... So I still get the typescript error in Next JS. Leaving these files and just adding the mentioned line to package.js would have done the trick, I think. And also the import is now broken, since the module is gone.

import Tempus from '@studio-freight/tempus';
Cannot find module '@studio-freight/tempus' or its corresponding type declarations

Also occurs for me, 0.0.42

vhorzinek avatar Jan 22 '24 17:01 vhorzinek

my bad, will be fixed asap, thx

clementroche avatar Jan 22 '24 17:01 clementroche

0.0.44 fixes it @vhorzinek

clementroche avatar Jan 22 '24 18:01 clementroche