From b8f3b9e55ead1608f67cf671fd2ea8683b59efea Mon Sep 17 00:00:00 2001 From: Ronen Amiel Date: Sun, 19 Jan 2025 23:30:01 +0200 Subject: [PATCH] add strict parent types for function declaration and export named/default nodes --- packages/types/src/ts-estree.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/types/src/ts-estree.ts b/packages/types/src/ts-estree.ts index c18a0895ace0..60790548254c 100644 --- a/packages/types/src/ts-estree.ts +++ b/packages/types/src/ts-estree.ts @@ -72,6 +72,34 @@ declare module './generated/ast-spec' { | TSESTree.ImportDeclaration; } + interface ExportDefaultDeclaration { + parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock; + } + + interface ExportNamedDeclarationWithoutSourceWithMultiple { + parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock; + } + + interface ExportNamedDeclarationWithoutSourceWithSingle { + parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock; + } + + interface ExportNamedDeclarationWithSource { + parent: TSESTree.BlockStatement | TSESTree.Program | TSESTree.TSModuleBlock; + } + + interface FunctionDeclarationWithName { + parent: + | TSESTree.BlockStatement + | TSESTree.ExportDefaultDeclaration + | TSESTree.ExportNamedDeclaration + | TSESTree.Program; + } + + interface FunctionDeclarationWithOptionalName { + parent: TSESTree.ExportDefaultDeclaration; + } + interface JSXAttribute { parent: TSESTree.JSXOpeningElement; }