Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Build Error - TS2403: Subsequent variable declarations must have the same type. #10

Closed
martypowell opened this issue Nov 6, 2017 · 8 comments

Comments

@martypowell
Copy link

Getting an error when running grunt package-dev. I can manually fix the error, but that just spits out another error.

**grunt package-dev
Running "ts:build" (ts) task
Compiling...
Using tsc v2.6.1
node_modules/@types/node/index.d.ts(73,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'require' must be of type 'Require', but here has type 'NodeRequire'.
node_modules/@types/react/index.d.ts(165,11): error TS2559: Type 'Component<P, S>' has no properties in common with type 'ComponentLifecycle<P, S>'.
typings/globals/knockout/index.d.ts(6,2): error TS2411: Property 'notifySubscribers' of type '(valueToWrite?: T, event?: string) => void' is not assignable to string index type 'KnockoutBindingHandle
r'.
typings/globals/knockout/index.d.ts(16,2): error TS2411: Property 'equalityComparer' of type '(a: any, b: any) => boolean' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(21,5): error TS2411: Property 'indexOf' of type '(searchElement: T, fromIndex?: number) => number' is not assignable to string index type 'KnockoutBindingHandler'.

typings/globals/knockout/index.d.ts(22,5): error TS2411: Property 'slice' of type '(start: number, end?: number) => T[]' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(23,5): error TS2411: Property 'splice' of type '{ (start: number): T[]; (start: number, deleteCount: number, ...items: T[]): T[]; }' is not assignable to string in
dex type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(25,5): error TS2411: Property 'pop' of type '() => T' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(26,5): error TS2411: Property 'push' of type '(...items: T[]) => void' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(27,5): error TS2411: Property 'shift' of type '() => T' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(28,5): error TS2411: Property 'unshift' of type '(...items: T[]) => number' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(29,5): error TS2411: Property 'reverse' of type '() => KnockoutObservableArray<T>' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(30,5): error TS2411: Property 'sort' of type '{ (): KnockoutObservableArray<T>; (compareFunction: (left: T, right: T) => number): KnockoutObser...' is not assignab
le to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(36,5): error TS2411: Property 'replace' of type '(oldItem: T, newItem: T) => void' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(38,5): error TS2411: Property 'remove' of type '{ (item: T): T[]; (removeFunction: (item: T) => boolean): T[]; }' is not assignable to string index type 'KnockoutB
indingHandler'.
typings/globals/knockout/index.d.ts(40,5): error TS2411: Property 'removeAll' of type '{ (items: T[]): T[]; (): T[]; }' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(43,5): error TS2411: Property 'destroy' of type '{ (item: T): void; (destroyFunction: (item: T) => boolean): void; }' is not assignable to string index type 'Knock
outBindingHandler'.
typings/globals/knockout/index.d.ts(45,5): error TS2411: Property 'destroyAll' of type '{ (items: T[]): void; (): void; }' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(60,2): error TS2411: Property 'subscribe' of type '{ (callback: (newValue: T) => void, target?: any, event?: string): KnockoutSubscription; <TEvent>...' is not ass
ignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(62,2): error TS2411: Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutSubscribable<T>' is not assignable to string index type 'K
nockoutBindingHandler'.
typings/globals/knockout/index.d.ts(63,2): error TS2411: Property 'getSubscriptionsCount' of type '() => number' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(77,2): error TS2411: Property 'dispose' of type '() => void' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(78,2): error TS2411: Property 'isActive' of type '() => boolean' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(79,2): error TS2411: Property 'getDependenciesCount' of type '() => number' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(80,5): error TS2411: Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutComputed<T>' is not assignable to string index type 'Knock
outBindingHandler'.
typings/globals/knockout/index.d.ts(90,5): error TS2411: Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutObservableArray<T>' is not assignable to string index type
 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(103,2): error TS2411: Property 'peek' of type '() => T' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(104,2): error TS2411: Property 'valueHasMutated' of type '() => void' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(105,2): error TS2411: Property 'valueWillMutate' of type '() => void' is not assignable to string index type 'KnockoutBindingHandler'.
typings/globals/knockout/index.d.ts(106,5): error TS2411: Property 'extend' of type '(requestedExtenders: { [key: string]: any; }) => KnockoutObservable<T>' is not assignable to string index type 'Kn
ockoutBindingHandler'.
typings/globals/vss/index.d.ts(3247,14): error TS2559: Type 'TemplateViewModel' has no properties in common with type 'EnhancementOptions'.
typings/globals/vss/index.d.ts(9305,14): error TS2415: Class 'ComboDateBehavior' incorrectly extends base class 'BaseComboBehavior'.
  Types of property 'getValue' are incompatible.
    Type '() => Date' is not assignable to type '<TValue>() => TValue'.
      Type 'Date' is not assignable to type 'TValue'.
typings/globals/vss/index.d.ts(9385,14): error TS2415: Class 'ComboMultiValueBehavior' incorrectly extends base class 'ComboListBehavior'.
  Types of property 'getValue' are incompatible.
    Type '() => string[]' is not assignable to type '<TValue>() => TValue'.
      Type 'string[]' is not assignable to type 'TValue'.
typings/globals/vss/index.d.ts(9551,14): error TS2417: Class static side 'typeof DialogO' incorrectly extends base class static side 'typeof AjaxPanelO'.
  Types of property 'create' are incompatible.
    Type '<T extends Dialog>(dialogType: new (options: any) => T, options?: any) => T' is not assignable to type '<TControl extends Control<any>, TOptions>(controlType: new (options: TOptions) => TCo
ntrol, conta...'.
      Types of parameters 'dialogType' and 'controlType' are incompatible.
        Type 'new (options: TOptions) => TControl' is not assignable to type 'new (options: any) => Dialog'.
          Type 'TControl' is not assignable to type 'Dialog'.
            Type 'Control<any>' is not assignable to type 'Dialog'.
              Property '_title' is missing in type 'Control<any>'.

>> 34 non-emit-preventing type warnings
>> Error: tsc return code: 2
Warning: Task "ts:build" failed. Use --force to continue.

Aborted due to warnings.
@mmanela
Copy link
Contributor

mmanela commented Nov 7, 2017

@ostreifel @mohitbagra can you help?

@jimNeff
Copy link

jimNeff commented Nov 7, 2017

I was able to get past this with: npm install tfx-cli
then re-run grunt

@martypowell
Copy link
Author

@jimNeff I receive the same error after doing what you suggest

@ostreifel
Copy link
Contributor

ostreifel commented Nov 13, 2017

this may be a typescript version error. I known a lot of things were broken after tsc version 2.3.3.
Switch to using typescript version 2.3.3

@pabrams
Copy link

pabrams commented May 8, 2018

@ostreifel I was getting the same error output as OP. I tried changing
"typescript": "^2.1.4",
to
"typescript": "2.3.3",
and I get different errors:

C:\Users\Paul.Abrams\Source\Repos\color-control>grunt test
Running "ts:buildTest" (ts) task
Compiling...
Using tsc v2.3.3
node_modules/@types/node/index.d.ts(89,13): error TS2403: Subsequent variable de
clarations must have the same type. Variable 'require' must be of type 'Require
', but here has type 'NodeRequire'.
node_modules/@types/node/index.d.ts(1975,45): error TS2304: Cannot find name 'It
erable'.
node_modules/@types/node/index.d.ts(1976,94): error TS2304: Cannot find name 'It
erable'.
node_modules/@types/node/index.d.ts(1979,20): error TS2304: Cannot find name 'It
erator'.
node_modules/@types/node/index.d.ts(1984,17): error TS2304: Cannot find name 'It
erator'.
node_modules/@types/node/index.d.ts(1988,19): error TS2304: Cannot find name 'It
erator'.
node_modules/@types/node/index.d.ts(1989,10): error TS2304: Cannot find name 'Sy
mbol'.
node_modules/@types/node/index.d.ts(1989,30): error TS2304: Cannot find name 'It
erator'.

8 non-emit-preventing type warnings
Error: tsc return code: 2
Warning: Task "ts:buildTest" failed. Use --force to continue.

Aborted due to warnings.

@pabrams
Copy link

pabrams commented May 8, 2018

Pinning to typescript 2.1.4 yields many more errors. Cannot find name 'object' in node_modules/@types/lodash

@ahmadyo
Copy link

ahmadyo commented Nov 10, 2018

and also:

Using tsc v2.1.4
node_modules/@types/glob/index.d.ts(17,66): error TS2304: Cannot find name 'Promise'.
node_modules/@types/jszip/index.d.ts(87,74): error TS2304: Cannot find name 'Promise'.
...
235 non-emit-preventing type warnings
Error: tsc return code: 2
Warning: Task "ts:build" failed. Use --force to continue.

Aborted due to warnings.

@mmanela
Copy link
Contributor

mmanela commented Apr 2, 2019

Dupe of #15

@mmanela mmanela closed this as completed Apr 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants