-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement/strict errors #2
Conversation
Thank you for the pull request, I will look at it by the end of this week. |
No problem. Thanks for this awesome port. I was going to do it myself but decided to google first and stumbled on this. |
Great job, this looks very good. I will make changes in the example game and update typescript in package.json and then I will accept your PR and push everything together to this repo. |
Awesome. I don't think I could have come up with a way to iterate through the Component fields in a Node class like you managed to do using the "keep" decorator. I learned a bit about decorators after seeing your implementation. Cool stuff! Thanks again for this. I'm trying to use it in an OpenFL project, but I think it needs a couple more tweaks. In /dist/ash.d.ts I had to add a module declaration for "ash.ts", basically a copy of the "ash" module.
And then I had to add this to ash.ts/package.json: "types": "./dist/ash.d.ts" This way I can import ash modules from a different project folder like so: myproject/src/main.ts:
Where ash.ts is installed under "myproject/node_modules/ash.ts" |
I do not quite understand how you want to use it in the Openfl project. I have not dealt with Haxe / OpenFL for almost a year, but from what I remember to use libraries written in other languages than Haxe you had to write extern files to them. No problem with package.json entry: |
Could you please try to change |
Yes! That worked. I ran "npm run build" and it updated the ambient module declaration names to "ash.ts". And you're right about typings, it works just like "types", it seems they're both equivalent. Good to know! As for OpenFL, jgranick released a npm version earlier this year, so you can now write openfl apps in typescript or javascript. I prefer at the moment the webpack + typescript + npm development environment so I'm playing around with it. I did use the haxe version of ash a while back, but now with typescript openfl, I wanted to try ash out with it and so far so good with these changes we've made. |
That's great! |
Will do. |
As of TypeScript 2.7, when strict is enabled, any class properties not initialized in the constructor will be reported as an error when accessed unless we use definite assignment assertions. So I squashed these property initialization errors. Dealt with the strict null error checks as well.
I also changed the Map-like property types from Array to Object to deal with other strict related errors. I initially wanted to switch to ES6 Map but decided to stick with Object so as to not require the Map type definition and needing to polyfill Map when targeting ES5 browsers.
Finally I updated 3 unit tests to deal with the undefined to null type changes.