3

I have recently updated VS2017 and I am seeing a lot of typescript build errors.

The errors are all the same, and all relate to the validity of d.ts files.

Here is the some code in a d.ts file that is causing a typescript compilation error (TS2411):

interface JQueryAjaxSettings {
}

interface DataSourceTransportCreate extends JQueryAjaxSettings {
    cache?: boolean;
    contentType?: string;
    data?: any;
    dataType?: string;
    type?: string;
    url?: any;
}

interface DataSourceTransport {
    create?: DataSourceTransportCreate;
    destroy?: DataSourceTransportDestroy;
    push?: Function;
    read?: DataSourceTransportRead;
    signalr?: DataSourceTransportSignalr;
    update?: DataSourceTransportUpdate;

    parameterMap?(data: DataSourceTransportParameterMapData, type: string): any;
}

interface DataSourceTransportOptions {
    success: (data?: any) => void;
    error: (error?: any) => void;
    data: any;
}

interface DataSourceTransportWithFunctionOperations extends DataSourceTransport {
    create?: (options: DataSourceTransportOptions) => void;
    destroy?: (options: DataSourceTransportOptions) => void;
    read?: (options: DataSourceTransportReadOptions) => void;
    update?: (options: DataSourceTransportOptions) => void;
}

The error is:

TS2430 (TS) Interface 'DataSourceTransportWithFunctionOperations' incorrectly extends interface 'DataSourceTransport'. Types of property 'create' are incompatible. Type '(options: DataSourceTransportOptions) => void' has no properties in common with type 'DataSourceTransportCreate'. Scripts (tsconfig project) C:\Users****\typings\kendo\kendo.all.d.ts 1202 Active "

This error is repeated for a whole host of other properties.

My question is - is this definition valid? Has there been some change that would cause this to suddenly become invalid (i.e shown as a build error in VS)?

7
  • What is the type of DataSourceTransportCreate? Is it possible that you updated your typescript version and it broke some interfaces? Commented Nov 22, 2017 at 13:10
  • I have edited the answer to add the definiton for DataSourceTransportCreate. Commented Nov 22, 2017 at 13:26
  • AFAIK the typescript version is specified in my csproj file: <TypeScriptToolsVersion>2.3</TypeScriptToolsVersion> and this hasn;t changed. Although my tsconfig file has this: "{ "version": "1.8.0"," not sure if that is relevent to this issue. Commented Nov 22, 2017 at 13:28
  • Did it ever work? DataSourceTransportCreate does not match at all the type, your new type is a function Commented Nov 22, 2017 at 13:32
  • 1
    as @Axnyff remarked, in interface DataSourceTransport, create? has type DataSourceTransportCreate and in DataSourceTransportWithFunctionOperations has type (options: DataSourceTransportOptions) => void Commented Nov 22, 2017 at 13:38

1 Answer 1

1

No, the definition is not valid. DataSourceTransportWithFunctionOperations's override of create(options: DataSourceTransportOptions): void is not compatible with the base create: DataSourceTransportCreate, which isn't a function at all, but an options bag.

Typescript has only detected these errors with option bags since 2.4, and this particular one maybe only since 2.5, since it involves a method type. The change is probably that your latest VS update switched you from Typescript 2.3 or 2.4 or higher.

The underlying problem is that the kendo typings are out of date. As you found, the official typings got a fix in August. If you update your typings, most should be fixed to compile without errors on newer versions of Typescript.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Latest update of VS2017 now seems to put TSC version 2.5.3 on it's PATH hence this issue. I was able to update the kendo typings but then had problems with knockout typings and other typings which I don't have time to fix. I found one other useful option in tsconfig file, under compiler options you can add: "skipLibCheck": true. This doesn't fix the issues, just leaves them hidden as before - so use with caution.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.