ui
ui copied to clipboard
Typescript
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 :(
Hi,
Have you tried creating .d.ts Files from .js files? https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html
Yes, But not working for me
@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.
@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 Sure, I would like to take a look.
@fancyapps I've submitted the PR #243 , you might need to revise these.
Are there any updates on this issue?
@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.
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.
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?
Hi, Fancybox5 has been available for some time and comes with TS types.
So happy to hear! Thank you!