mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 01:39:28 -06:00
Use combined node flags (#39403)
This commit is contained in:
parent
7b728754c0
commit
fcd4fcb3d7
@ -13307,7 +13307,7 @@ namespace ts {
|
||||
function isUncalledFunctionReference(node: Node, symbol: Symbol) {
|
||||
return !(symbol.flags & (SymbolFlags.Function | SymbolFlags.Method))
|
||||
|| !isCallLikeExpression(findAncestor(node, n => !isAccessExpression(n)) || node.parent)
|
||||
&& every(symbol.declarations, d => !isFunctionLike(d) || !!(d.flags & NodeFlags.Deprecated));
|
||||
&& every(symbol.declarations, d => !isFunctionLike(d) || !!(getCombinedNodeFlags(d) & NodeFlags.Deprecated));
|
||||
}
|
||||
|
||||
function getPropertyTypeForIndexType(originalObjectType: Type, objectType: Type, indexType: Type, fullIndexType: Type, suppressNoImplicitAnyError: boolean, accessNode: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression | undefined, accessFlags: AccessFlags, reportDeprecated?: boolean) {
|
||||
@ -22092,7 +22092,7 @@ namespace ts {
|
||||
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
||||
let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration;
|
||||
|
||||
if (declaration?.flags & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, localOrExportSymbol)) {
|
||||
if (declaration && getCombinedNodeFlags(declaration) & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, localOrExportSymbol)) {
|
||||
errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string);;
|
||||
}
|
||||
if (localOrExportSymbol.flags & SymbolFlags.Class) {
|
||||
|
||||
46
tests/cases/fourslash/jsdocDeprecated_suggestion6.ts
Normal file
46
tests/cases/fourslash/jsdocDeprecated_suggestion6.ts
Normal file
@ -0,0 +1,46 @@
|
||||
// @Filename: a.tsx
|
||||
//// /** @deprecated */
|
||||
//// type Props = {}
|
||||
|
||||
//// /** @deprecated */
|
||||
//// const Component = (props: [|Props|]) => props && <div />;
|
||||
|
||||
//// <[|Component|] old="old" new="new" />
|
||||
|
||||
//// /** @deprecated */
|
||||
//// type Options = {}
|
||||
|
||||
//// /** @deprecated */
|
||||
//// const deprecatedFunction = (options: [|Options|]) => { options }
|
||||
|
||||
//// [|deprecatedFunction|]({});
|
||||
|
||||
goTo.file('a.tsx')
|
||||
const ranges = test.ranges();
|
||||
|
||||
verify.getSuggestionDiagnostics([
|
||||
{
|
||||
message: "'Props' is deprecated",
|
||||
code: 6385,
|
||||
range: ranges[0],
|
||||
reportsDeprecated: true,
|
||||
},
|
||||
{
|
||||
message: "'Component' is deprecated",
|
||||
code: 6385,
|
||||
range: ranges[1],
|
||||
reportsDeprecated: true
|
||||
},
|
||||
{
|
||||
message: "'Options' is deprecated",
|
||||
code: 6385,
|
||||
range: ranges[2],
|
||||
reportsDeprecated: true,
|
||||
},
|
||||
{
|
||||
message: "'deprecatedFunction' is deprecated",
|
||||
code: 6385,
|
||||
range: ranges[3],
|
||||
reportsDeprecated: true,
|
||||
}
|
||||
])
|
||||
Loading…
x
Reference in New Issue
Block a user