Address code review
This commit is contained in:
parent
8899d5f056
commit
ac8ae27139
3 changed files with 9 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(14,71): error TS2339: Property 'join' does not exist on type 'string | string[]'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(14,70): error TS2339: Property 'join' does not exist on type 'string | string[]'.
|
||||
tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,44): error TS2339: Property 'toLowerCase' does not exist on type 'string | number'.
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,4
|
|||
// have no effect on members of objects such as properties.
|
||||
|
||||
// Note that the class's property must be copied to a local variable for
|
||||
// the type guard to have an affect
|
||||
// the type guard to have an effect
|
||||
class D {
|
||||
data: string | string[];
|
||||
getData() {
|
||||
|
@ -16,8 +16,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsOnClassProperty.ts(26,4
|
|||
}
|
||||
|
||||
getData1() {
|
||||
return typeof this.data === "string" ? this.data : this. data.join(" ");
|
||||
~~~~
|
||||
return typeof this.data === "string" ? this.data : this.data.join(" ");
|
||||
~~~~
|
||||
!!! error TS2339: Property 'join' does not exist on type 'string | string[]'.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// have no effect on members of objects such as properties.
|
||||
|
||||
// Note that the class's property must be copied to a local variable for
|
||||
// the type guard to have an affect
|
||||
// the type guard to have an effect
|
||||
class D {
|
||||
data: string | string[];
|
||||
getData() {
|
||||
|
@ -12,7 +12,7 @@ class D {
|
|||
}
|
||||
|
||||
getData1() {
|
||||
return typeof this.data === "string" ? this.data : this. data.join(" ");
|
||||
return typeof this.data === "string" ? this.data : this.data.join(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if (typeof prop1 === "string" && prop1.toLocaleLowerCase()) { }
|
|||
// Note that type guards affect types of variables and parameters only and
|
||||
// have no effect on members of objects such as properties.
|
||||
// Note that the class's property must be copied to a local variable for
|
||||
// the type guard to have an affect
|
||||
// the type guard to have an effect
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// have no effect on members of objects such as properties.
|
||||
|
||||
// Note that the class's property must be copied to a local variable for
|
||||
// the type guard to have an affect
|
||||
// the type guard to have an effect
|
||||
class D {
|
||||
data: string | string[];
|
||||
getData() {
|
||||
|
@ -11,7 +11,7 @@ class D {
|
|||
}
|
||||
|
||||
getData1() {
|
||||
return typeof this.data === "string" ? this.data : this. data.join(" ");
|
||||
return typeof this.data === "string" ? this.data : this.data.join(" ");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue