Skip to content
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

Add instructions for getting type checking to work for JS projects #174

Closed
wants to merge 6 commits into from

Conversation

dunhor
Copy link
Member

@dunhor dunhor commented Feb 9, 2022

Fixes #159

docs/USAGE.md Outdated
Comment on lines 80 to 83
1. [OPTIONAL] By default, `rnwinrt.exe` will output `*.d.ts` type declaration files under the path `/windows/WinRTTurboModule/Generated Files/types`. If your project is using TypeScript, these files will get picked up automatically, assuming you haven't changed your `tsconfig.json` to exclude it. If you are using Javascript as well as Visual Studio Code to edit files, you can follow the instructions outlined [here](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_type-checking-javascript) to get type checking as well as auto-complete. Namely, this involves adding a `jsconfig.json` to the root of your project and the coment `// @ts-check` to the top of all desired `*.js` files. If you are using an editor other than Visual Studio code, then you may need to consult your editor's documentation as these steps may not work for you, if the scenario is even supported at all.

* *NOTE: There are currently a number of known issues with the generation of type declaration files, so you may see some innocuous errors reported by the editor, even though the code will work properly in practice*

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break this up into a couple of lines?

also maybe we should just say "rename your app.js to app.tsx" as the 1st option, and give the other options as fallbacks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't renaming the file have other implications? E.g. such as needing to declare types everywhere? Or is the default in TS to just assume that anything unmarked is any?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

people will usually have @types/react etc included in their project but I suppose folks can use react native from non TS too. The default template is confusing though. @acoates-ms thoughts? (not sure if he'll get this msg since the repo is private still, message offline if not)

asklar
asklar previously approved these changes Feb 9, 2022
docs/USAGE.md Outdated Show resolved Hide resolved
angelazhangmsft
angelazhangmsft previously approved these changes Feb 9, 2022
Co-authored-by: angelazhangmsft <[email protected]>
docs/USAGE.md Outdated Show resolved Hide resolved
@dunhor
Copy link
Member Author

dunhor commented Apr 12, 2022

This is not really relevant any more with the changes to add the npm package

@dunhor dunhor closed this Apr 12, 2022
@dunhor dunhor deleted the dunhor/improvements branch April 12, 2022 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typings are missing
3 participants