Skip to content

Commit 0907c39

Browse files
mohsen1claude
andcommitted
feat(checker): Add satisfies operator and type assertions checking
Implement type checking for TypeScript's satisfies operator and type assertions: ## Satisfies Operator (satisfies.rs) - Check `expression satisfies Type` expressions - Preserve narrower inferred type while validating against target type - Support const assertion interaction with satisfies - Proper handling of literal types preservation - Validates assignability without widening ## Type Assertions (assertions.rs) - Check `as T` syntax type assertions - Check `<T>` angle bracket assertions (with TSX detection) - Check `as const` assertions for literal preservation - Implement non-null assertion operator (!) - Validate assertion compatibility rules (type overlap) - Handle assertion to/from unknown and any - Support double assertion escape hatch pattern ## Key Features - 35 new tests covering all assertion/satisfies scenarios - Integration with TypeChecker for consistent options - Proper error codes matching TypeScript diagnostics - Support for strict null checks mode Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8739292 commit 0907c39

4 files changed

Lines changed: 1579 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)