-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added implementation for issue #25002 #25415
Changes from 6 commits
51caec2
2f0cc53
f82d295
9aa2468
bf1af7a
d39e424
1d968ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1304,7 +1304,7 @@ | |
"category": "Error", | ||
"code": 2379 | ||
}, | ||
"'get' and 'set' accessor must have the same type.": { | ||
"'get' and 'set' accessor must have the same type '{0}'.": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking
with
However, to be honest, I'm not sure how I feel about this change; I feel like the simpler error message was actually better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just the |
||
"category": "Error", | ||
"code": 2380 | ||
}, | ||
|
@@ -2409,6 +2409,10 @@ | |
"category": "Error", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be |
||
"code": 2729 | ||
}, | ||
"The respective 'set' accessor has the type '{0}'.": { | ||
"category": "Message", | ||
"code": 2730 | ||
}, | ||
|
||
"Import declaration '{0}' is using private name '{1}'.": { | ||
"category": "Error", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS2380: 'get' and 'set' accessor must have the same type. | ||
tests/cases/compiler/getAndSetNotIdenticalType.ts(2,9): error TS2380: 'get' and 'set' accessor must have the same type 'string'. | ||
tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
tests/cases/compiler/getAndSetNotIdenticalType.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. | ||
|
||
|
||
==== tests/cases/compiler/getAndSetNotIdenticalType.ts (4 errors) ==== | ||
==== tests/cases/compiler/getAndSetNotIdenticalType.ts (3 errors) ==== | ||
class C { | ||
get x(): number { | ||
~ | ||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
~ | ||
!!! error TS2380: 'get' and 'set' accessor must have the same type. | ||
!!! error TS2380: 'get' and 'set' accessor must have the same type 'string'. | ||
!!! related TS2730 tests/cases/compiler/getAndSetNotIdenticalType.ts:2:9: The respective 'set' accessor has the type 'string'. | ||
return 1; | ||
} | ||
set x(v: string) { } | ||
~ | ||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
~ | ||
!!! error TS2380: 'get' and 'set' accessor must have the same type. | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type. | ||
tests/cases/compiler/getAndSetNotIdenticalType2.ts(5,9): error TS2380: 'get' and 'set' accessor must have the same type 'A<string>'. | ||
tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
tests/cases/compiler/getAndSetNotIdenticalType2.ts(8,9): error TS2380: 'get' and 'set' accessor must have the same type. | ||
tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A<string>' is not assignable to type 'A<T>'. | ||
Type 'string' is not assignable to type 'T'. | ||
|
||
|
||
==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (5 errors) ==== | ||
==== tests/cases/compiler/getAndSetNotIdenticalType2.ts (4 errors) ==== | ||
class A<T> { foo: T; } | ||
|
||
class C<T> { | ||
|
@@ -15,14 +14,13 @@ tests/cases/compiler/getAndSetNotIdenticalType2.ts(9,9): error TS2322: Type 'A<s | |
~ | ||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
~ | ||
!!! error TS2380: 'get' and 'set' accessor must have the same type. | ||
!!! error TS2380: 'get' and 'set' accessor must have the same type 'A<string>'. | ||
!!! related TS2730 tests/cases/compiler/getAndSetNotIdenticalType2.ts:5:9: The respective 'set' accessor has the type 'A<string>'. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should not repeat the same type in each message |
||
return this.data; | ||
} | ||
set x(v: A<string>) { | ||
~ | ||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. | ||
~ | ||
!!! error TS2380: 'get' and 'set' accessor must have the same type. | ||
this.data = v; | ||
~~~~~~~~~ | ||
!!! error TS2322: Type 'A<string>' is not assignable to type 'A<T>'. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove newline.