Closed russellsteadman closed 7 months ago
It might be useful to switch the source files to TypeScript, and then the issues would be able to be caught automatically and the import type MyDefaultType from ...
and import {type MyType} from ...
syntax could be utilized. I can make a pull request with these changes if that is something the maintainers would be interested in.
I really have no idea on how to fix this, as it does sound like a consequence of switching to separate files when generating the TypeScript definitions files (@see #1162)
but definitely there is no intention to switch the whole source code to TypeScript for now. Maybe an "intermediate" solution would be to have an additional TypeScript within the source file that would contains type definition for all major public classes ? and that files would then be added to the batch of automatically generated d.ts files ? can this work ?
@lartkma by any chance, do you have any idea/suggestions ?
The next.js configuration template file has a good example of importing types in JSDoc for pure JS files.
If you don't want to convert the source to TypeScript, it may be good to implement some tests in TypeScript and simply see if the test files pass type checking. This will help with debugging.
that interesting ! Since you were proposing it earlier, would be interested in making a pull request for it ? I'm asking as I'm not personally using TS, this way you can verify directly that this working for you ?
note that we are using webdoc (https://www.webdoclabs.com) as well for the documentation, which is supposed to also support some TypeScript tags or semantic (not sure how to put it). Now I never tried, but if some are missing @ShukantPal can hopefully help :)
this to say as well that if you do make a pull request and do it by modifying the documentation tags, make sure the doc generation is not broken. just use npm run doc-local
and make sure it does not throw you any errors.
thanks a ton!
closing this one , see #1199
Describe the bug
When I type checked my files, I noticed quite a few type errors due to inconsistent typings. For example, Renderable's body references the JavaScript DOM
document.body
type because the type fromphysics/body.js
is not imported.To Reproduce (Example)
Entity
.Entity
togame.world
with theaddChild
method.Entity.body
does not implementRenderable.body
.Expected behavior No type errors for the action.
Version: