5

I set up a new project using the yeoman template for SharePoint Framework web parts. Everything is working fine, I can run gulp serve and work in the local workbench. Good.

Now I need to change the TypeScript version. When running gulp serve the console is showing:

[09:12:38] [typescript] TypeScript version: 2.1.6

Where does this version come from? How can I bump this to 2.2.x?

1 Answer 1

8

The mystery is solved. The typescript version is pulled in by tslint and in turn by the internal gulp-related typescript.

The output of "TypeScript version: 2.1.6" happens when the tslint task starts a typescript compilation:

enter image description here

Looking at the "package.json" in "node_modules/@microsoft/sp-tslint-rules" I can see this typescript dependency:

"@microsoft/gulp-core-build-typescript": ">=2.2.5 <3.0.0",

Now looking in "package.json" of "gulp-core-build-typescript" I see this typescript dependency:

"typescript": "~2.1.4"

This means: the highest typescript version starting with "2.1" will be used.

Looking at the available typescript versions shows "2.1.6" as being the highest one available:

npm view typescript versions --json

enter image description here

So that's why the version is 2.1.6. And since it's part of a chain of packages working together I won't touch it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.