feat(types): ship TypeScript definitions directly from the lock repo#2763
Merged
ankita10119 merged 3 commits intomasterfrom Apr 2, 2026
Merged
feat(types): ship TypeScript definitions directly from the lock repo#2763ankita10119 merged 3 commits intomasterfrom
ankita10119 merged 3 commits intomasterfrom
Conversation
Piyush-85
reviewed
Apr 2, 2026
Piyush-85
approved these changes
Apr 2, 2026
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.
Changes
The
@types/auth0-lockpackage on DefinitelyTyped is significantly out of date (last updated for v11, current version is v14). Several constructor options introduced since then,forceAutoHeight,mobile,disableWarnings,preferConnectionDisplayName,useCustomPasswordlessConnection,emailFirst,connectionResolver, andhooks, were missing, causing TypeScript consumers to get compiler errors or fall back to any.This PR ships type definitions directly from the lock repo by adding
"types": "types/index.d.ts"topackage.json. TypeScript resolves this automatically at install time, so no separate@types/ packageis needed. The definitions include a type-level test file (types/auth0-lock-tests.ts) and atypes/tsconfig.jsonfor local validation.Note on Version Compatibility / Fallback Behavior
The bundled types are scoped to v14+ only by the nature of npm versioning - no explicit version guard is needed in the code.
How it works:
npm install auth0-lock (v14) → consumer gets the package.json that contains "types": "types/index.d.ts". TypeScript reads this field automatically at install time and resolves the bundled definitions.
npm install auth0-lock@11/@12/@13→ those published tarballs have no "types" field and notypes/directory. TypeScript finds nothing bundled and falls back to@types/auth0-lockfrom DefinitelyTyped as before.The boundary is purely physical - the
types/directory simply does not exist in older published versions on npm.Side effect to be aware of: Once a user upgrades to
v14,@types/auth0-lockis silently ignored in favour of the bundled types. If they had any local type augmentations or workarounds against@types/auth0-lock, those may stop working.References
Resolves #2741
Testing
Checklist