forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
this
when it appears in this is T
positions
Fixes microsoft#59252
- Loading branch information
1 parent
bf39ecc
commit 54a83b9
Showing
11 changed files
with
66 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
tests/baselines/reference/declarationEmitThisPredicates02.errors.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//// [tests/cases/compiler/thisPredicateInObjectLiteral.ts] //// | ||
|
||
//// [thisPredicateInObjectLiteral.ts] | ||
// Should be OK | ||
const foo2 = { | ||
isNumber(): this is { b: string } { | ||
return true; | ||
}, | ||
}; | ||
|
||
//// [thisPredicateInObjectLiteral.js] | ||
"use strict"; | ||
// Should be OK | ||
var foo2 = { | ||
isNumber: function () { | ||
return true; | ||
}, | ||
}; |
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/thisPredicateInObjectLiteral.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//// [tests/cases/compiler/thisPredicateInObjectLiteral.ts] //// | ||
|
||
=== thisPredicateInObjectLiteral.ts === | ||
// Should be OK | ||
const foo2 = { | ||
>foo2 : Symbol(foo2, Decl(thisPredicateInObjectLiteral.ts, 1, 5)) | ||
|
||
isNumber(): this is { b: string } { | ||
>isNumber : Symbol(isNumber, Decl(thisPredicateInObjectLiteral.ts, 1, 14)) | ||
>b : Symbol(b, Decl(thisPredicateInObjectLiteral.ts, 2, 25)) | ||
|
||
return true; | ||
}, | ||
}; |
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/thisPredicateInObjectLiteral.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//// [tests/cases/compiler/thisPredicateInObjectLiteral.ts] //// | ||
|
||
=== thisPredicateInObjectLiteral.ts === | ||
// Should be OK | ||
const foo2 = { | ||
>foo2 : { isNumber(): this is { b: string; }; } | ||
> : ^^^^^^^^^^^^^^ ^^^ | ||
>{ isNumber(): this is { b: string } { return true; },} : { isNumber(): this is { b: string; }; } | ||
> : ^^^^^^^^^^^^^^ ^^^ | ||
|
||
isNumber(): this is { b: string } { | ||
>isNumber : () => this is { b: string; } | ||
> : ^^^^^^ | ||
>b : string | ||
> : ^^^^^^ | ||
|
||
return true; | ||
>true : true | ||
> : ^^^^ | ||
|
||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// @strict: true | ||
|
||
// Should be OK | ||
const foo2 = { | ||
isNumber(): this is { b: string } { | ||
return true; | ||
}, | ||
}; |