Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 23, 2024
1 parent 9cf9a18 commit 91cb55f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ export const REGEX: RegexPatterns = {
defaultExport: /export\s+default\s+/,

// New patterns for complex types
// eslint-disable-next-line regexp/no-super-linear-backtracking
complexType: /type\s+([^=<]+)(?:<[^>]+>)?\s*=\s*([^;]+)/,
// eslint-disable-next-line regexp/no-super-linear-backtracking
unionIntersection: /([^|&]+)(?:\s*[|&]\s*([^|&]+))+/,
mappedType: /\{\s*\[\s*([^\]]+)\s*in\s*([^\]]+)\s*\]:/,
conditionalType: /([^extnds]+)\s+extends\s+([^?]+)\s*\?\s*([^:]+)\s*:\s*([^;]+)/,
// eslint-disable-next-line regexp/no-super-linear-backtracking
mappedType: /\{\s*\[\s*([^\]]+)in\s*([^\]]+)\]:/,
// eslint-disable-next-line regexp/no-super-linear-backtracking
conditionalType: /([^extnds]+)\s+extends\s+([^?]+)\?\s*([^:]+):\s*([^;]+)/,
genericConstraints: /<([^>]+)>/,
functionOverload: /^(?:export\s+)?(?:declare\s+)?function\s+([^(<\s]+)/,
} as const satisfies RegexPatterns
Expand Down

0 comments on commit 91cb55f

Please sign in to comment.