Skip to content

Commit 3c11605

Browse files
committed
refactor(compat-eslint): generic-typed defineShape + whenAbsent tests
Addresses review on PR #89: defineShape<TsT extends ts.Node>(...): each call site now binds the TS node type via generic. tsField is constrained to keys of TsT, so typos like `tsField: 'thenSttement'` fail at compile time. consts callback parameter is auto-inferred (no per-shape `(tn: ts.X) =>` annotation needed). 46 defineShape sites updated with their concrete TS type parameter. All build + tests still pass. Two focused factory unit tests in lazy-estree.test: - TSTypeQuery.typeArguments returns undefined (not null) for absent slot, AND is an own-property (eager parity), AND memoises on second read. - ReturnStatement.argument returns null (not undefined) for bare `return;` — the default whenAbsent='null' is honoured. Also confirmed via Dify bench that there's no perf regression — cold ~11s (improved vs PR #88's 13s baseline; the earlier 14s reading was disk warmup), warm ~6s. The factory's hidden-class shape transitions land on V8's monomorphic happy path.
1 parent d9eb700 commit 3c11605

2 files changed

Lines changed: 107 additions & 66 deletions

File tree

0 commit comments

Comments
 (0)