nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
664 stars 169 forks source link

Ts declarations #958

Closed papillot closed 1 year ago

papillot commented 1 year ago

This PR contains a new round about Typescript declarations.

  1. Currently declarations are not shipped via npm: the user still has to make the compilation locally to get the files. This is due to a line in git ignore which prevents committing the declaration folder located in ./dist/
  2. Various improvements to declarations, mainly function parameters which had been wrongly typed previously. This collection of fixes comes from unwarranted typescript errors that were raised in a project I am working on. Notably: color parameter can be a string (was limited to numbers), autoview() can take a selection string as a parameter, labelText takes an array of strings,...
ppillot commented 1 year ago

Do not merge yet. There is an issue after build where all cylinders appear black

ppillot commented 1 year ago

Issue with the cylinders solved (spurious testing code introduced has been removed)

fredludlow commented 1 year ago

Do you want me to make a release and check declarations get pushed?

papillot commented 1 year ago

Thanks for this! Yes a release would be nice. I think we can make 2.1 as we have the sdf v3000 new feature.

fredludlow commented 1 year ago

I've pushed 2.1.0-0 with the @next tag (i.e.npm install ngl@next). That seems to have packed the declarations in with it. Let me know if it's okay and I'll push it as 2.1.0 (latest tag)

papillot commented 1 year ago

Yes! I've done a quick test: create a new repository, npm install ngl@next, create a .ts file, and I can import from NGL modules and have all the typings at hand!

Thanks a lot! This actually concludes the TS migration initiated 5 years ago 💯

fredludlow commented 1 year ago

2.1.0 released