danzen / zimjs

ZIM JavaScript Canvas Framework - Code Creativity! Interactive Media For All.
Other
508 stars 47 forks source link

please update typing definition for typescript user #47

Closed BibbyChung closed 2 years ago

BibbyChung commented 2 years ago

Hi there,

I reference https://zimjs.com/typescript.html to start my ZIMjs project. I find out some typing is not correct. like...

// zim/index.d.ts
export function zimify(obj:createjs.DisplayObject, list:boolean):DisplayObject

I follow this typing to write code.

const exportRooot: createjs.MovieClip = ...
const zContainer = zimify(exportRoot, false);
zContainer.setBounds(0,0,stageW,stageH).center();

It doesn't work. Because zContainer is null. And I change my code to...

const exportRooot: createjs.MovieClip = ...
const zContainer = zimify(exportRoot);
zContainer.setBounds(0,0,stageW,stageH).center();

It work well. But zimify function typing definition is not existed.

I know maintain typing definition is hard and boring. So..Could you update ZIMjs typing definition or let me send "pull request" etc.

Thanks.

danzen commented 2 years ago

Hi @BibbyChung - thanks. The second parameter should have been optional so we have updated the Typings at https://zimjs.com/typescript.html - thanks for letting us know. And thanks for the note at https://zimjs.com/slack - it is always helpful for a quick response. Also, the true was to be used internally, and ZIM had a bad test for the false... so it ended up outputting something unexpected. So we are tidying up ZIM as well.