PR Feedback
This commit is contained in:
parent
6bbacb64ce
commit
80a7716117
|
@ -12744,10 +12744,12 @@ namespace ts {
|
||||||
if (declaration.type) {
|
if (declaration.type) {
|
||||||
return getTypeFromTypeNode(declaration.type);
|
return getTypeFromTypeNode(declaration.type);
|
||||||
}
|
}
|
||||||
const jsDocType = isInJavaScriptFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
|
if (isInJavaScriptFile(declaration)) {
|
||||||
|
const jsDocType = getTypeForDeclarationFromJSDocComment(declaration);
|
||||||
if (jsDocType) {
|
if (jsDocType) {
|
||||||
return jsDocType;
|
return jsDocType;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (declaration.kind === SyntaxKind.Parameter) {
|
if (declaration.kind === SyntaxKind.Parameter) {
|
||||||
const type = getContextuallyTypedParameterType(<ParameterDeclaration>declaration);
|
const type = getContextuallyTypedParameterType(<ParameterDeclaration>declaration);
|
||||||
if (type) {
|
if (type) {
|
||||||
|
|
|
@ -2625,7 +2625,6 @@ namespace ts {
|
||||||
if (accessor && accessor.parameters.length > 0) {
|
if (accessor && accessor.parameters.length > 0) {
|
||||||
const hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);
|
const hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]);
|
||||||
const parameter = accessor.parameters[hasThis ? 1 : 0];
|
const parameter = accessor.parameters[hasThis ? 1 : 0];
|
||||||
if (parameter) {
|
|
||||||
if (parameter.type) {
|
if (parameter.type) {
|
||||||
return parameter.type;
|
return parameter.type;
|
||||||
}
|
}
|
||||||
|
@ -2634,7 +2633,6 @@ namespace ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export function getThisParameter(signature: SignatureDeclaration): ParameterDeclaration | undefined {
|
export function getThisParameter(signature: SignatureDeclaration): ParameterDeclaration | undefined {
|
||||||
if (signature.parameters.length) {
|
if (signature.parameters.length) {
|
||||||
|
|
|
@ -10,3 +10,39 @@ const arr = [
|
||||||
>y : Symbol(y, Decl(index.js, 3, 11))
|
>y : Symbol(y, Decl(index.js, 3, 11))
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @return {function(): Array<[string, {x?:number, y?:number}]>} */
|
||||||
|
function f() {
|
||||||
|
>f : Symbol(f, Decl(index.js, 4, 2))
|
||||||
|
|
||||||
|
return [
|
||||||
|
['a', { x: 1 }],
|
||||||
|
>x : Symbol(x, Decl(index.js, 9, 15))
|
||||||
|
|
||||||
|
['b', { y: 2 }]
|
||||||
|
>y : Symbol(y, Decl(index.js, 10, 15))
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class C {
|
||||||
|
>C : Symbol(C, Decl(index.js, 12, 1))
|
||||||
|
|
||||||
|
/** @param {function(): Array<[string, {x?:number, y?:number}]>} value */
|
||||||
|
set x(value) { }
|
||||||
|
>x : Symbol(C.x, Decl(index.js, 14, 9))
|
||||||
|
>value : Symbol(value, Decl(index.js, 16, 10))
|
||||||
|
|
||||||
|
get () {
|
||||||
|
>get : Symbol(C.get, Decl(index.js, 16, 20))
|
||||||
|
|
||||||
|
return [
|
||||||
|
['a', { x: 1 }],
|
||||||
|
>x : Symbol(x, Decl(index.js, 19, 19))
|
||||||
|
|
||||||
|
['b', { y: 2 }]
|
||||||
|
>y : Symbol(y, Decl(index.js, 20, 19))
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -19,3 +19,59 @@ const arr = [
|
||||||
>2 : 2
|
>2 : 2
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @return {function(): Array<[string, {x?:number, y?:number}]>} */
|
||||||
|
function f() {
|
||||||
|
>f : () => () => [string, { x?: number; y?: number; }][]
|
||||||
|
|
||||||
|
return [
|
||||||
|
>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { [x: string]: any; x: number; })[] | (string | { [x: string]: any; y: number; })[])[]
|
||||||
|
|
||||||
|
['a', { x: 1 }],
|
||||||
|
>['a', { x: 1 }] : (string | { [x: string]: any; x: number; })[]
|
||||||
|
>'a' : "a"
|
||||||
|
>{ x: 1 } : { [x: string]: any; x: number; }
|
||||||
|
>x : number
|
||||||
|
>1 : 1
|
||||||
|
|
||||||
|
['b', { y: 2 }]
|
||||||
|
>['b', { y: 2 }] : (string | { [x: string]: any; y: number; })[]
|
||||||
|
>'b' : "b"
|
||||||
|
>{ y: 2 } : { [x: string]: any; y: number; }
|
||||||
|
>y : number
|
||||||
|
>2 : 2
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class C {
|
||||||
|
>C : C
|
||||||
|
|
||||||
|
/** @param {function(): Array<[string, {x?:number, y?:number}]>} value */
|
||||||
|
set x(value) { }
|
||||||
|
>x : any
|
||||||
|
>value : () => [string, { x?: number; y?: number; }][]
|
||||||
|
|
||||||
|
get () {
|
||||||
|
>get : () => ((string | { [x: string]: any; x: number; })[] | (string | { [x: string]: any; y: number; })[])[]
|
||||||
|
|
||||||
|
return [
|
||||||
|
>[ ['a', { x: 1 }], ['b', { y: 2 }] ] : ((string | { [x: string]: any; x: number; })[] | (string | { [x: string]: any; y: number; })[])[]
|
||||||
|
|
||||||
|
['a', { x: 1 }],
|
||||||
|
>['a', { x: 1 }] : (string | { [x: string]: any; x: number; })[]
|
||||||
|
>'a' : "a"
|
||||||
|
>{ x: 1 } : { [x: string]: any; x: number; }
|
||||||
|
>x : number
|
||||||
|
>1 : 1
|
||||||
|
|
||||||
|
['b', { y: 2 }]
|
||||||
|
>['b', { y: 2 }] : (string | { [x: string]: any; y: number; })[]
|
||||||
|
>'b' : "b"
|
||||||
|
>{ y: 2 } : { [x: string]: any; y: number; }
|
||||||
|
>y : number
|
||||||
|
>2 : 2
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,9 +2,29 @@
|
||||||
// @checkJs: true
|
// @checkJs: true
|
||||||
// @noEmit: true
|
// @noEmit: true
|
||||||
// @filename: index.js
|
// @filename: index.js
|
||||||
|
// @target: esnext
|
||||||
|
|
||||||
/** @type {Array<[string, {x?:number, y?:number}]>} */
|
/** @type {Array<[string, {x?:number, y?:number}]>} */
|
||||||
const arr = [
|
const arr = [
|
||||||
['a', { x: 1 }],
|
['a', { x: 1 }],
|
||||||
['b', { y: 2 }]
|
['b', { y: 2 }]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @return {function(): Array<[string, {x?:number, y?:number}]>} */
|
||||||
|
function f() {
|
||||||
|
return [
|
||||||
|
['a', { x: 1 }],
|
||||||
|
['b', { y: 2 }]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class C {
|
||||||
|
/** @param {function(): Array<[string, {x?:number, y?:number}]>} value */
|
||||||
|
set x(value) { }
|
||||||
|
get () {
|
||||||
|
return [
|
||||||
|
['a', { x: 1 }],
|
||||||
|
['b', { y: 2 }]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue