You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression bug - false typescript error with regards to generics and generics inference #28445
I use a complex structure of classes, interfaces and generics.
The generic type is inferred by the first paramter of the class constructor.
In the current version I get a syntax highlight error that I did not receive in older versions (few month ago).
Here are some screenshots - and the code is below:
And the errors are:
and:
Here's the type script code with two members - one that get's the syntax error and one that works.
class ClassA<classType> {
constructor(private entity?: classType, public settings?: SettingsInterface<classType>) {
}
}
export interface valueInterface<classType> {
func?: (row: classType) => any;
value?: string;
}
export interface SettingsInterface<classType> {
values?: (row: classType) => valueInterface<classType>[],
}
class myClass{
theName='myClass';
}
var thisGetsTheFalseError = new ClassA(new myClass(), {
values: o => [
{
value: o.theName,
func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj'
}
]
});
var thisIsOk = new ClassA<myClass>(new myClass(), {
values: o => [
{
value: o.theName,
func: x => 'asdfkjhgfdfghjkjhgfdfghjklkjhgfdfghjklkjhgfghj'
}
]
});
VS Code version: Code 1.28.2 (7f3ce96ff4729c91352ae6def877e59c561f4850, 2018-10-17T00:23:51.859Z)
OS version: Windows_NT x64 10.0.17134
System Info
Item
Value
CPUs
Intel(R) Core(TM) i7-5930K CPU @ 3.50GHz (12 x 3500)
changed the title [-]Regression bug - syntax highlight displays false typescript error with regards to generics and generics inference[/-][+]Regression bug - false typescript error with regards to generics and generics inference[/+]on Nov 9, 2018
One more clarification - I confirmed that in typescript 3.1.6 it's a build error.
Previously in TypeScript 2.5.3 - it worked as expected without any build errors or syntax highlight errors.
Wesley Wigham (@weswigham) I've retested this using the latest vscode and typescript 3.5.1 and it's still not working - how can I test if it was fixed?
Activity
[-]Regression bug - syntax highlight displays false typescript error with regards to generics and generics inference[/-][+]Regression bug - false typescript error with regards to generics and generics inference[/+]noam-honig commentedon Nov 11, 2018
Just to clarify - it's not a typescript build error (at least in the typescript version I'm building with) - it's an error syntax highlight in VS Code
noam-honig commentedon Nov 11, 2018
One more clarification - I confirmed that in typescript 3.1.6 it's a build error.
Previously in TypeScript 2.5.3 - it worked as expected without any build errors or syntax highlight errors.
RyanCavanaugh commentedon Mar 14, 2019
Regression starting at 3.1
noam-honig commentedon Jun 20, 2019
Wesley Wigham (@weswigham) I've retested this using the latest vscode and typescript 3.5.1 and it's still not working - how can I test if it was fixed?
weswigham commentedon Jun 20, 2019
You'd have to use the nightly -
typescript@next- and configure vscode to use the installed version oftypescript.