Skip to content

feat(types): ship TypeScript definitions directly from the lock repo#2763

Merged
ankita10119 merged 3 commits intomasterfrom
SDK-8514
Apr 2, 2026
Merged

feat(types): ship TypeScript definitions directly from the lock repo#2763
ankita10119 merged 3 commits intomasterfrom
SDK-8514

Conversation

@ankita10119
Copy link
Copy Markdown
Contributor

@ankita10119 ankita10119 commented Apr 1, 2026

Changes

The @types/auth0-lock package 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, and hooks, 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" to package.json. TypeScript resolves this automatically at install time, so no separate @types/ package is needed. The definitions include a type-level test file (types/auth0-lock-tests.ts) and a types/tsconfig.json for 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 no types/ directory. TypeScript finds nothing bundled and falls back to @types/auth0-lock from 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-lock is 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

  • This change adds unit test coverage
  • This change adds integration test coverage
  • This change has been tested on the latest version of the platform/language

Checklist

@ankita10119 ankita10119 requested a review from a team as a code owner April 1, 2026 11:21
@ankita10119 ankita10119 merged commit 39098d9 into master Apr 2, 2026
5 checks passed
@ankita10119 ankita10119 deleted the SDK-8514 branch April 2, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The forceAutoHeight configuration option is not included under Auth0LockConstructorOptions from @types/auth0-lock

2 participants