Repository navigation
refactor!: use type aliases and replace any with exact types - #3
Merged
Merged
Conversation
- replace all interfaces with type aliases and rename interfaces.ts to types.ts - remove I prefix from generic type parameters - replace any with unknown for inputs and remove as any casts - fix types that did not match runtime values - enforce type aliases, no I prefix and no explicit any via eslint BREAKING CHANGE: types can no longer be extended via declaration merging. QuaireQuestion.navigationItemId is optional, selectOptions, rangeOption and inputOption can be null, QuaireNavigationItem.componentType can be null and QuaireNavigationItem.value is any instead of string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is accomplished by your PR?
Interfaces → type aliases
srcandexamplesare now type aliasessrc/interfaces.tsis renamed tosrc/types.tsIItem,IQuestion,INavigationItemare renamed toItem,Question,NavigationItemany→ exact types (27 of 32 replaced)saveAnswer, answer parameters,QuaireOptions.result,QuaireItem.defaultValue) useunknowngetByPathis generic,isNilis a type guardas anycasts are replaced: objects are built asQuaireQuestion/QuaireNavigationItemand then cast to the generic typeanyon purpose (getResult(),_result,QuaireQuestion.value,QuaireQuestion.defaultValue,QuaireNavigationItem.value), because consumers read them directlyTypes fixed to match runtime values
QuaireNavigationItem.valuestringany(arrays, booleans,null)QuaireNavigationItem.componentTypenull| null(parents without question)QuaireQuestion.navigationItemIdQuaireQuestion.selectOptions/rangeOption/inputOptionnull| nullESLint rules
@typescript-eslint/consistent-type-definitions: type@typescript-eslint/naming-convention: noIprefix for types@typescript-eslint/no-explicit-anyenabled, the 5 exceptions are documented inlineIs there something controversial in your PR?
Breaking changes for TypeScript consumers:
nullmust be handled for the fixed types listed above withstrictmodequaire/dist/interfacesbreak (nowdist/types)Normal imports from
quaireandinterface X extends QuaireItemin consumer code still work.Checklist
🤖 Generated with Claude Code