-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Generated types are not passing strict mode (I think) #187
Comments
Hi @HarelM, I'm sorry for the late reply. Is it still the issue? I just tried to reproduce it and it seems to work now, most likely because of the fixes from your side. If so, is it possible to share what caused the issue? Thanks! |
I've changed the code to workaround this issue but I think this is still an issue... |
Can you provide steps to reproduce the issue then please? |
Take maplibre-gl code from before feb 24 (when the fixed was merge https://github.com/maplibre/maplibre-gl-js/pull/1023d). |
Well, looks like the types you were using here couldn't be compiled so that's why you had this error. You can paste that code to typescript playground and see that it will report an error:
These types are created by the compiler itself and the tool isn't part of this process and cannot control them. If you have an error here, you need to provide proper types for this function manually. I'm not sure why you don't see such errors (probably you don't run the compiler to type check? or maybe because of your compiler options ¯_(ツ)_/¯), but they were in your project before and should be fixed in the code. |
Hi, I know this is a bit late to the party, here's my scenario, I'm not sure what should be the solution here, but it would be great if this tool had a flag that can check if the output is passing strict typescript transpilation.
In order to "fix" the above I did the following "hack": maplibre/maplibre-gl-js#2623 (added another tsconfig.json file and added tsc run to my CI). It would be great if I could pass a commandline angument flag like Let me know if you would like me to open a new issue on this. |
Hey @HarelM, The tool compiles (checks) generated dts file with compiler options defined in your provided tsconfig. Don't you have Another little trick - if you don't provide I was thinking maybe to introduce a new flag, something like |
Naaa, adding a different config file isn't what I was thinking about, although this can be a valuable option for some projects, but for me, if I added another config file I can easily add a type check using this file, I was hoping for a more "built in" solution. |
@HarelM What do you mean? Isn't it what you want to achieve?
I don't think a built-in solution like "compile in strict mode" is valuable as it is too specific. Next day ppl will ask to add an option to compile with some other flags, and then another ones and we will come up with tens of different flags that would replicate tsconfig basically. |
Yea, I understand your point, makes sense... |
Bug report
Seems like the generated code is not passing angular compilation for some reason.
Generated file can be found here:
https://unpkg.com/browse/maplibre-gl@2.1.6/dist/maplibre-gl.d.ts
The following issue seems to describe well the steps to reproduce:
maplibre/maplibre-gl-js#934
There are two unrelated issue which I'm not sure how to properly solve:
Produces the error:
I'm not sure why.
https://github.com/maplibre/maplibre-gl-js/blob/51054671229c68d798fa06a64968aa35688f6a0f/src/ui/map.ts#L920
Creates the following typings:
Which causes the following errors:
Which I think make sense as the
[x: string]: (e: any) => void;
is incompatible with the other two mouse events.Is this something that can/should be fixed in this repo or there's a need to change the original code some how?
Thanks again for this great project!!
The text was updated successfully, but these errors were encountered: