/** * Map a TypeScript Declaration to the function-shaped node that owns * its catalog entry. * * Four resolver files used to inline their own near-identical copy * of this logic — each accepting a slightly different set of * declaration shapes. The duplicated-function-body rule flagged the * group; consolidating onto one helper with a `DeclShape` bitmask * makes the per-resolver intent explicit. * * Declaration shapes are bit flags so callers can OR exactly the * subset their resolver accepts. The mask is matched against the * declaration type before unwrapping (Variable / Property * declarations dereference their initializer to find the actual * function-shape). */ import ts from 'typescript'; /** * Bit-flag set of declaration shapes acceptable in a given resolver * context. OR the shapes a resolver should accept and pass the result * to {@link functionLikeFromDeclaration}. */ export declare const DeclShape: { /** `function foo() {}` */ readonly FunctionDeclaration: 1; /** `() => ...` */ readonly ArrowFunction: 2; /** `function () {}` (the expression form). */ readonly FunctionExpression: 4; /** Class method: `foo() {}` inside a class body. */ readonly MethodDeclaration: 8; /** `constructor() {}`. */ readonly ConstructorDeclaration: 16; /** `get foo() {}` / `set foo(v) {}`. */ readonly Accessor: 32; /** Interface method declarations: `foo(): void;`. */ readonly MethodSignature: 64; /** Class property declarations (used by polymorphic dispatch). */ readonly PropertyDeclaration: 128; /** `const foo = () => ...` / `const foo = function () {}` — unwrap initializer. */ readonly VariableInitializer: 256; /** `{ foo: () => ... }` / `{ foo: function () {} }` — unwrap initializer. */ readonly PropertyAssignmentInitializer: 512; }; /** * Return the function-shaped node that should be hashed against the * catalog for declaration `d`, given the caller's `accept` mask. * Returns null when `d` doesn't match any accepted shape. * * Variable / property assignments are unwrapped to their initializer * function only when the corresponding `*Initializer` bit is set. * Direct function-shapes are accepted only when their specific bit * is set — passing `DeclShape.ArrowFunction` accepts a bare arrow * declaration but NOT a `const foo = () => ...` (you'd need to OR * `VariableInitializer` for that). */ export declare function functionLikeFromDeclaration(d: ts.Declaration, accept: number): ts.Node | null; //# sourceMappingURL=declaration-to-node.d.ts.map