You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I agree with this from my personal experience, I find this statement unnecessarily opinionated. I would prefer to see language that doesn't have any risk of implying that not using TS is somehow non-idiomatic. If I were completely unfamiliar with TS but interested in using it, I would feel more welcomed with softer language such as Using TypeScript is a very popular option for writing JavaScript code.
The Let's get started section is overly prescriptive on tooling.
I shouldn't need to learn how to install and use mise, Bun, or tiged in order to learn how to set up TypeScript in an XS project. I understand that these tools are serving as prerequisites for using a template repository that has the configuration of actual interest, but if that's their sole purpose it would make more sense to just point to the template repo and let the user decide how they want to make use of it.
The TSConfig used in the template repository can be improved
I mentioned this in the Matrix chat but there's an easier way to include all of the relevant types provided by the Moddable SDK. It boils down to having the following in the tsconfig.json (omitting various options for brevity):
Using the typeRoots field allows you to avoid having to explicitly specify the XS modules of interest in the types field, which doesn't work well with some of the types provided by Moddable due to nesting (in which case using the paths field becomes helpful).
This is mostly relevant for typechecking but should be useful for projects that convert TypeScript code to JavaScript code. From my testing, this has the intended affect of being able to access the types when importing the various XS modules and using the global types defined by xs. Would be helpful for others to confirm that this works as expected and no other changes are needed.
Depending on other tools being used in the project (such as Node for general project tooling), you may need to update "types" in order to include modules whose types may need to be accessed implicitly:
"types": ["node", "xs"]
In general, I think the page should really focus on addressing the following scenarios:
I want to write TypeScript-flavored JavaScript for an XS project. How do I configure TypeScript to support that?
I want to write pure TypeScript code for an XS project. How do I configure and use TypeScript to do that?
The text was updated successfully, but these errors were encountered:
Referring to https://xs-dev.js.org/guide/usage-with-typescript/ as of 4dbbe16, there are a couple of things that don't sit well with me personally:
While I agree with this from my personal experience, I find this statement unnecessarily opinionated. I would prefer to see language that doesn't have any risk of implying that not using TS is somehow non-idiomatic. If I were completely unfamiliar with TS but interested in using it, I would feel more welcomed with softer language such as
Using TypeScript is a very popular option for writing JavaScript code.
Let's get started
section is overly prescriptive on tooling.I shouldn't need to learn how to install and use mise, Bun, or tiged in order to learn how to set up TypeScript in an XS project. I understand that these tools are serving as prerequisites for using a template repository that has the configuration of actual interest, but if that's their sole purpose it would make more sense to just point to the template repo and let the user decide how they want to make use of it.
I mentioned this in the Matrix chat but there's an easier way to include all of the relevant types provided by the Moddable SDK. It boils down to having the following in the
tsconfig.json
(omitting various options for brevity):Using the
typeRoots
field allows you to avoid having to explicitly specify the XS modules of interest in thetypes
field, which doesn't work well with some of the types provided by Moddable due to nesting (in which case using thepaths
field becomes helpful).This is mostly relevant for typechecking but should be useful for projects that convert TypeScript code to JavaScript code. From my testing, this has the intended affect of being able to access the types when importing the various XS modules and using the global types defined by
xs
. Would be helpful for others to confirm that this works as expected and no other changes are needed.Depending on other tools being used in the project (such as Node for general project tooling), you may need to update
"types"
in order to include modules whose types may need to be accessed implicitly:In general, I think the page should really focus on addressing the following scenarios:
I want to write TypeScript-flavored JavaScript for an XS project. How do I configure TypeScript to support that?
I want to write pure TypeScript code for an XS project. How do I configure and use TypeScript to do that?
The text was updated successfully, but these errors were encountered: