I have a VSTS extension which was built on typescript 1.8.10. I want to upgrade it to the latest typescript 3.1.6. I could do that by issuing npm i typescript@3.1.6 --save-dev. However, after doing so, I'm receiving number of errors from *.d.ts files. Mainly from knockout.d.ts and node.d.ts. I've tried below:
The errors look like below:
[15:45:28] Compiling TypeScript files using tsc version 3.1.6
[15:45:37] [tsc] > definitions/knockout.d.ts(10,2): error TS2411: Property 'notifySubscribers' of type '(valueToWrite?: T, event?: string) => void' is not assignable to string index type 'KnockoutBindingHandler'.
[15:45:37] [tsc] > definitions/knockout.d.ts(20,2): error TS2411: Property 'equalityComparer' of type '(a: any, b: any) => boolean' is not assignable to string index type 'KnockoutBindingHandler'.
[15:45:37] [tsc] > definitions/knockout.d.ts(25,5): error TS2411: Property 'indexOf' of type '(searchElement: T, fromIndex?: number) => number' is not assignable to string index type 'KnockoutBindingHandler'.
[15:45:37] [tsc] > definitions/knockout.d.ts(26,5): error TS2411: Property 'slice' of type '(start: number, end?: number) => T[]' is not assignable to string index type 'KnockoutBindingHandler'.
Nothing seems to be working so far. Appreciate if someone can guide me on this.
Thank you.
So I was able to get around this.
First thing was 'vss-web-extension-sdk' was not supporting TS 3.0 at that time.
So I had to use TS 2.9.2 instead. The other thing was I changed all my previous references like;
///<reference path="../definitions/Q.d.ts" />
to
/// <reference type="Q" />
These solved most of the errors.