Repository navigation
feat!: prepare 1.0 API (typed result, package exports, navigation fix) - #4
Merged
Merged
Conversation
…tems getNavigation() threw a TypeError when a child navigation item came before its parent. Parents are now added first. Children with an unknown parent are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- add Result type parameter to Quaire, QuaireBase and QuaireOptions - getResult() returns QuairePartialResult<Result> - question and navigation values are unknown instead of any - add type tests with expectTypeOf and document typed results BREAKING CHANGE: getResult(), QuaireQuestion.value, QuaireQuestion.defaultValue and QuaireNavigationItem.value are no longer any. Pass a result type as fourth type parameter or narrow the values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- add exports map with types and default condition - remove examples from the published package - remove .npmignore, files already defines the package content BREAKING CHANGE: deep imports like quaire/dist/types are no longer possible and examples are no longer part of the npm package. 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?
Three changes for the 1.0 release, one commit each.
1. fix(navigation): support children before their parent
getNavigation()threw aTypeErrorwhen a child navigation item came before its parent innavigationItems. Parents are now added first. Children with an unknown parent are ignored.2. feat!: generic result type, no
anyleftResultonQuaire,QuaireBaseandQuaireOptions(defaultRecord<string, unknown>)getResult()returnsQuairePartialResult<Result>: every answer is optional and can benull(missing until given,nullwhen invalidated)QuaireQuestion.value,QuaireQuestion.defaultValueandQuaireNavigationItem.valueareunknownobject)expectTypeOf, checked bynpm run typecheck3. build!: package exports
exportsmap withtypesanddefaultconditiondistis published (examples removed,.npmignoreremoved)Tested with the packed tarball in an empty project:
requireandimportwork, TypeScript works withnode16andbundlerresolution,quaire/dist/typesis blocked (ERR_PACKAGE_PATH_NOT_EXPORTED).Is there something controversial in your PR?
Breaking changes (planned for 1.0):
getResult()and all answer values are no longerany. Consumers must pass a result type or narrow the values.quaire/dist/...are no longer possible.Resultis the fourth type parameter, so all other type parameters must be passed to set it.Checklist
🤖 Generated with Claude Code