The possibility of TypeScript in Meteor become a reality and official supported. It was discussed here Official TypeScript compiler coming to Meteor
We’re starting to convert some .js files to .ts https://github.com/meteor/meteor/labels/Project%3ATypeScript-conversion
But I think we need to accept some code style for TS at first.
@benjamn Do you have idea about it? may be some template?
UPDATED 17 Jul
Q https://github.com/meteor/meteor/pull/10614#issue-296046123 @menewman
- Is the correct way to check for TS errors in this project just to open the project in VSCode and see if it gets angry? (That’s what I did and it seemed to work… okay.)
- For whatever reason, TypeScript lets me get away with code like
const pipe = require("multipipe");but not
import pipe from "multipipe";, because for the latter version it wants me to install the type defs for that package via NPM. I have no idea how to add new NPM dependencies to
meteor/toolsand I’m not sure whether it’s advised/allowed even for TS types. What do you recommend we do in cases like that?
- I submitted this into the
release-1.8.2branch because that’s where your “convert files.ts” PR was targeted, but I’m not sure if this was the right thing to do, since the Contributing guides seem to encourage submitting into
develdoesn’t seem to have all of your TS-related changes from
- Yes, I think we should use external tools (especially VSCode) for TypeScript type checking, and let
meteor-babelsimply do the compilation. That said, you can also run
meteor npx tscfrom within the
meteor/toolsdirectory, which is something we should do as part of our Circle CI tests (edit: implemented by 06b5f32).
- Totally fine to keep it like this (using
require) for now. At some point we’ll do a pass to convert everything to
imports and make sure the appropriate
@types/…packages are installed. That’s the kind of thing that should be easy to automate, so I don’t want to waste human time.
Technically, we will need to add
dev-bundle-tool-package.jsand rebuild the dev bundle. You can simulate that (without rebuilding the dev bundle) by running
meteor npm install -g @types/split2.
- Yep, the
release-1.8.2branch is the only place (besides
release-1.9, which is still experimental) where TypeScript is supported.
Add @firstname.lastname@example.org to both dev-bundle-tools-package.js and dev-bundle-server-package.js
@types/semveris important because multiple files that should be transformed to TypeScript require it (e.g.
Regarding the versioning mismatch. There shouldn’t be any problems since the only difference between 5.4.0 and 5.4.1 is the addition of a
try...catchstatement in commit semver/7be83d15dcff73f6, so the interface wasn’t changed.
… This will require rebuilding the dev bundle after I merge it into release-1.8.2, though you can do that locally by running
scripts/generate-dev-bundle.sh rm -rf dev_bundle meteor --help # downloads the new dev bundle
release-1.8.2branch to merge your pull request
cd path/to/meteor/tools && ../meteor npx tscto compile TS code in tools
- Install global
npm i -g @types/XXXif you need it.
Also it can be a part of dev-bundle in