mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-12 12:57:11 -06:00
Update to push types through as well
This commit is contained in:
parent
50eca44e46
commit
1f9153f801
@ -2958,12 +2958,22 @@ namespace ts {
|
||||
function getTypeOfAccessors(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
const getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
|
||||
const setter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.SetAccessor);
|
||||
|
||||
if (getter.flags & NodeFlags.JavaScriptFile) {
|
||||
const jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter);
|
||||
if (jsDocType) {
|
||||
return links.type = jsDocType;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
|
||||
return unknownType;
|
||||
}
|
||||
const getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
|
||||
const setter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.SetAccessor);
|
||||
|
||||
let type: Type;
|
||||
|
||||
// First try to see if the user specified a return type on the get-accessor.
|
||||
const getterReturnType = getAnnotatedAccessorType(getter);
|
||||
if (getterReturnType) {
|
||||
|
||||
@ -2,25 +2,19 @@
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: file.js
|
||||
//// let x = {
|
||||
//// /** This is cool*/
|
||||
//// get m() {
|
||||
//// return 0;
|
||||
//// }
|
||||
//// /**
|
||||
//// * This is a very cool function that is very nice.
|
||||
//// * @returns something
|
||||
//// * @param p anotherthing
|
||||
//// */
|
||||
//// function a1(p) {
|
||||
//// try {
|
||||
//// throw new Error('x');
|
||||
//// } catch (x) { x--; }
|
||||
//// return 23;
|
||||
//// }
|
||||
//// x.m/*1*/;
|
||||
////
|
||||
//// class Foo {
|
||||
//// /** This is cool too*/
|
||||
//// get b() {
|
||||
//// return 0;
|
||||
//// }
|
||||
//// }
|
||||
//// var y = new Foo();
|
||||
//// y.b/*2*/;
|
||||
////
|
||||
//// x - /**/a1()
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs(undefined, 'This is cool');
|
||||
|
||||
goTo.marker('2');
|
||||
verify.quickInfoIs(undefined, 'This is cool too');
|
||||
goTo.marker();
|
||||
verify.quickInfoExists();
|
||||
29
tests/cases/fourslash/getJavaScriptQuickInfo8.ts
Normal file
29
tests/cases/fourslash/getJavaScriptQuickInfo8.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: file.js
|
||||
//// let x = {
|
||||
//// /** @type {number} */
|
||||
//// get m() {
|
||||
//// return undefined;
|
||||
//// }
|
||||
//// }
|
||||
//// x.m/*1*/;
|
||||
////
|
||||
//// class Foo {
|
||||
//// /** @type {string} */
|
||||
//// get b() {
|
||||
//// return undefined;
|
||||
//// }
|
||||
//// }
|
||||
//// var y = new Foo();
|
||||
//// y.b/*2*/;
|
||||
|
||||
goTo.marker('1');
|
||||
edit.insert('.');
|
||||
verify.memberListContains('toFixed', undefined, undefined, 'method');
|
||||
edit.backspace();
|
||||
|
||||
goTo.marker('2');
|
||||
edit.insert('.');
|
||||
verify.memberListContains('substr', undefined, undefined, 'method');
|
||||
Loading…
x
Reference in New Issue
Block a user