mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Handle unresolved baseType when trying to get completions for static member (#39731)
* Handle unresolved baseType when trying to get completions for static member Fixes #38067 * Update src/services/completions.ts Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> * correct the condition Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
parent
c5d21e7987
commit
48e58f44db
@ -2012,7 +2012,9 @@ namespace ts.Completions {
|
||||
// List of property symbols of base type that are not private and already implemented
|
||||
const baseSymbols = flatMap(getAllSuperTypeNodes(decl), baseTypeNode => {
|
||||
const type = typeChecker.getTypeAtLocation(baseTypeNode);
|
||||
return type && typeChecker.getPropertiesOfType(classElementModifierFlags & ModifierFlags.Static ? typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl) : type);
|
||||
return classElementModifierFlags & ModifierFlags.Static ?
|
||||
type?.symbol && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) :
|
||||
type && typeChecker.getPropertiesOfType(type);
|
||||
});
|
||||
symbols = filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags);
|
||||
}
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: /node_modules/@types/react/index.d.ts
|
||||
//// export = React;
|
||||
//// export as namespace React;
|
||||
//// declare namespace React {
|
||||
//// function createElement(): any;
|
||||
//// interface Component<P = {}, S = {}, SS = any> { }
|
||||
//// class Component<P, S> {
|
||||
//// static contextType?: any;
|
||||
//// context: any;
|
||||
//// constructor(props: Readonly<P>);
|
||||
//// setState<K extends keyof S>(
|
||||
//// state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null),
|
||||
//// callback?: () => void
|
||||
//// ): void;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
// @Filename: /a.ts
|
||||
//// import React from 'react'
|
||||
//// class Slider extends React.Component {
|
||||
//// static defau/**/ltProps = {
|
||||
//// onMouseDown: () => { },
|
||||
//// onMouseUp: () => { },
|
||||
//// unit: 'px',
|
||||
//// }
|
||||
//// handleChange = () => 10;
|
||||
//// }
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
isNewIdentifierLocation: true,
|
||||
exact: completion.classElementKeywords,
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user