ui icon indicating copy to clipboard operation
ui copied to clipboard

Typescript

Open israel-lpz opened this issue 4 years ago • 10 comments

I have wanted to use it in a project with typescript and I have encountered the problem that it does not have Declaration Files or an npm @types package :(

israel-lpz avatar Sep 07 '21 04:09 israel-lpz

Hi,

Have you tried creating .d.ts Files from .js files? https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html

fancyapps avatar Sep 13 '21 10:09 fancyapps

Yes, But not working for me

israel-lpz avatar Sep 13 '21 18:09 israel-lpz

@fancyapps

create .d.ts using this way will create so many junk, like these

declare namespace defaults {

this defaults namespace is just a useless and is a very strange way of typescript declaration.

and I see your codes are written by es6 syntax, maybe you should consider use typescript to write the code and compile to esm, umd, and even es2019.

if this is not the way, then we need a correct typescript definition files and put this file in packages.json file, otherwise our typescript project still can not use it directly. and this is how threejs doing the typescript thing.

steve3d avatar Jan 27 '22 05:01 steve3d

@fancyapps I have created a simple version of typescript definitions, but I'm not sure if all the functions should be exposed to typescript.

Should I create a PR?

steve3d avatar Feb 14 '22 05:02 steve3d

@steve3d Sure, I would like to take a look.

fancyapps avatar Feb 14 '22 10:02 fancyapps

@fancyapps I've submitted the PR #243 , you might need to revise these.

steve3d avatar Feb 15 '22 02:02 steve3d

Are there any updates on this issue?

tech-goldenphoenix avatar Apr 07 '22 02:04 tech-goldenphoenix

@tech-goldenphoenix I am very sorry, but it is not humanly possible to work on the two major versions at the same time while also providing support. You can check out steve3d's kindly provided PR or you'll have to wait for the next major version. If you are curious about the progress, then it is going quite well, I have already migrated Base and Panzoom components to TypeScript while also improving existing functionality and adding new features. Now I am working on revamping Carousel component.

fancyapps avatar Apr 07 '22 05:04 fancyapps

well, there would be huge work to do if you rewrite whole library with typescript, an simple solution is merge my d.ts, because those are just types, not actual codes.

If you change the class name, methods or arguments, just update the type definitions. It's not an complex task.

steve3d avatar Apr 07 '22 16:04 steve3d

How's this coming along? We love FancyApps, but TS is a non-negotiable for us. I don't wanna have to find another package to use if TS support is right around the corner?

jacobgraf avatar Sep 05 '22 16:09 jacobgraf

Hi, Fancybox5 has been available for some time and comes with TS types.

fancyapps avatar Mar 12 '23 11:03 fancyapps

So happy to hear! Thank you!

jacobgraf avatar Mar 12 '23 12:03 jacobgraf