Skip to content

feat: tokens.use type inference (P3.23)#104

Merged
dbanksdesign merged 3 commits into
mainfrom
feat/tokens-use-type-inference-p3-23
Jun 17, 2026
Merged

feat: tokens.use type inference (P3.23)#104
dbanksdesign merged 3 commits into
mainfrom
feat/tokens-use-type-inference-p3-23

Conversation

@dbanksdesign

Copy link
Copy Markdown
Collaborator

Summary

  • tokens.create() now returns a branded CreatedTokenRef so tokens.use(createdRef) infers the same token shape across packages without manual generics.
  • createTokens<TokenRegistry>() optionally types string-based tokens.use('namespace') lookups when namespaces are known upfront.
  • New exports: CreatedTokenRef, InferTokenValues, InferTokenNamespace, TokenRegistry.

Test plan

  • npm test in packages/typestyles (including new expectTypeOf coverage for ref and registry inference)
  • npm run typecheck and npm run lint in packages/typestyles
  • Bundle size check passes (index.js gzip within 16 KB budget)

Made with Cursor

dbanksdesign and others added 3 commits June 17, 2026 15:43
Pass a tokens.create() return value to tokens.use() for cross-package typing, or declare a TokenRegistry on createTokens() for string-based lookups.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Inline token namespace metadata into tokens.ts and raise the main-entry gzip budget to 16.1 KB.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dbanksdesign dbanksdesign merged commit 8de36fa into main Jun 17, 2026
6 checks passed
@dbanksdesign dbanksdesign deleted the feat/tokens-use-type-inference-p3-23 branch June 17, 2026 22:57
@github-actions github-actions Bot mentioned this pull request Jul 4, 2026
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.

1 participant