-
Notifications
You must be signed in to change notification settings - Fork 18
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
Solution for #72 + Add type definitions for Text(D)Encoder #86
Solution for #72 + Add type definitions for Text(D)Encoder #86
Conversation
- Enable global console
- Improve documentation for Text(D)Encoder - Add an explicit type listing all available encoding suported by Gjs TextDecoder
…fig file - Warn gjs users if the project includes DOM lib - Don't generate conflicting types in Gjs global when project includes DOM lib
- Add notice recommending modifing tsconfig.json for GJS projects
Will check why the tests are failing |
- Fix a bug in readTsJsConfig that caused it to not resolve relative paths parents - Change typescript to a runtime dependency due to the usage of its internal JSON parser
So, typescript has its own parser for |
outddir is not required to exists when the tsconfig.json parse logic executes
@HeavenVolkoff Another alternative is jsonc-parser which is from Microsoft, so maybe this package is also used internally in TypeScript? I have used pkg-types in another project which can read the P.S. Today is my birthday and I just saw your pull requests today, which is a great birthday present, thank you! :) Edit |
Although jsonc-parser seems to be a good option, it isn't what Typescript uses internally, they actually implemented their own parser, because they seem to try parsing some broken JSON without failing. Here you can see their parser implementation:
Oh, that is a good point, I didn't consider it when I implemented this XD. Just went with the simplest solution. But, I would say it is the main advantage of using TS own parsing logic, even if they change format or break compatibility, it would have very little effect on this project.
Hey man, Happy Birthday 🎂. Hope you enjoy your day. |
Hello,
This PR presents a solution for #72. It adds a notice to the README informing users that it is recommended to edit their
tsconfig.json
file for GJS projects. Besides, logic was built to check, during runtime, if the project has theDOM
lib in itstsconfig.json
and if that is the case ask the user if he wants to skip generating any conflicting type.Also, included in this PR are the definitions for the Text(D)Encoder interfaces added in GJS 1.69.2:
https://gitlab.gnome.org/GNOME/gjs/-/blob/572f8e8c/NEWS#L384-393
https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/Encoding.md
https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_encoding/encoding.js