forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix prototype property type lookup (microsoft#33034)
* Fix constructor function type reference lookup I knew I missed some code in the constructor-functions-as-classes PR. This simplifies the type reference resolution code as well. * Simplify and document js alias type resolution
- Loading branch information
Showing
4 changed files
with
134 additions
and
53 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
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/jsdocConstructorFunctionTypeReference.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,31 @@ | ||
=== tests/cases/conformance/salsa/jsdocConstructorFunctionTypeReference.js === | ||
var Validator = function VFunc() { | ||
>Validator : Symbol(Validator, Decl(jsdocConstructorFunctionTypeReference.js, 0, 3)) | ||
>VFunc : Symbol(VFunc, Decl(jsdocConstructorFunctionTypeReference.js, 0, 15)) | ||
|
||
this.flags = "gim" | ||
>flags : Symbol(VFunc.flags, Decl(jsdocConstructorFunctionTypeReference.js, 0, 34)) | ||
|
||
}; | ||
|
||
Validator.prototype.num = 12 | ||
>Validator.prototype : Symbol(Validator.num, Decl(jsdocConstructorFunctionTypeReference.js, 2, 2)) | ||
>Validator : Symbol(Validator, Decl(jsdocConstructorFunctionTypeReference.js, 0, 3)) | ||
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) | ||
>num : Symbol(Validator.num, Decl(jsdocConstructorFunctionTypeReference.js, 2, 2)) | ||
|
||
/** | ||
* @param {Validator} state | ||
*/ | ||
var validateRegExpFlags = function(state) { | ||
>validateRegExpFlags : Symbol(validateRegExpFlags, Decl(jsdocConstructorFunctionTypeReference.js, 9, 3)) | ||
>state : Symbol(state, Decl(jsdocConstructorFunctionTypeReference.js, 9, 35)) | ||
|
||
return state.flags | ||
>state.flags : Symbol(VFunc.flags, Decl(jsdocConstructorFunctionTypeReference.js, 0, 34)) | ||
>state : Symbol(state, Decl(jsdocConstructorFunctionTypeReference.js, 9, 35)) | ||
>flags : Symbol(VFunc.flags, Decl(jsdocConstructorFunctionTypeReference.js, 0, 34)) | ||
|
||
}; | ||
|
||
|
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/jsdocConstructorFunctionTypeReference.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,40 @@ | ||
=== tests/cases/conformance/salsa/jsdocConstructorFunctionTypeReference.js === | ||
var Validator = function VFunc() { | ||
>Validator : typeof VFunc | ||
>function VFunc() { this.flags = "gim"} : typeof VFunc | ||
>VFunc : typeof VFunc | ||
|
||
this.flags = "gim" | ||
>this.flags = "gim" : "gim" | ||
>this.flags : any | ||
>this : any | ||
>flags : any | ||
>"gim" : "gim" | ||
|
||
}; | ||
|
||
Validator.prototype.num = 12 | ||
>Validator.prototype.num = 12 : 12 | ||
>Validator.prototype.num : any | ||
>Validator.prototype : any | ||
>Validator : typeof VFunc | ||
>prototype : any | ||
>num : any | ||
>12 : 12 | ||
|
||
/** | ||
* @param {Validator} state | ||
*/ | ||
var validateRegExpFlags = function(state) { | ||
>validateRegExpFlags : (state: VFunc) => string | ||
>function(state) { return state.flags} : (state: VFunc) => string | ||
>state : VFunc | ||
|
||
return state.flags | ||
>state.flags : string | ||
>state : VFunc | ||
>flags : string | ||
|
||
}; | ||
|
||
|
19 changes: 19 additions & 0 deletions
19
tests/cases/conformance/salsa/jsdocConstructorFunctionTypeReference.ts
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,19 @@ | ||
// @noEmit: true | ||
// @allowJs: true | ||
// @checkJs: true | ||
// @noImplicitAny: true | ||
// @Filename: jsdocConstructorFunctionTypeReference.js | ||
|
||
var Validator = function VFunc() { | ||
this.flags = "gim" | ||
}; | ||
|
||
Validator.prototype.num = 12 | ||
|
||
/** | ||
* @param {Validator} state | ||
*/ | ||
var validateRegExpFlags = function(state) { | ||
return state.flags | ||
}; | ||
|