Skip to content

Remove the magic program from Typekits #7018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 18, 2025

Conversation

chrisradek
Copy link
Member

@chrisradek chrisradek commented Apr 16, 2025

Fixes #6789
This builds off of the POC PR #6865 from @joheredi

In short, this PR gets rid of the default typekit (e.g. being able to use $.api without passing in a program). Now it is required to first pass in a TypeSpec program or realm before calling Typekits (e.g. $(program).api)

To reduce friction for emitter authors, the emitter-framework package exposes the useTsp() hook which returns a typekit that's been instantiated with a program. Also included an Output component that accepts a program so that the new context provider doesn't need to be manually created.

ToDo:

Copy link
Contributor

github-actions bot commented Apr 17, 2025

All changed packages have been documented.

  • @typespec/compiler
  • @typespec/emitter-framework
  • @typespec/http-client-js
  • @typespec/http-client
  • @typespec/http-server-js
  • @typespec/http
  • @typespec/openapi3
Show changes

@typespec/compiler - feature ✏️

Removes the default typekit in favor of always instantiating typekits with either a program or realm.

@typespec/emitter-framework - feature ✏️

Adds the TspContextProvider and useTsp() hook for providing and accessing TypeSpec context and the Typekit APIs (e.g. $). Adds a new Output component that accepts a TypeSpec Program and automatically wraps children components with the TspContextProvider.

@typespec/http-client-js - internal ✏️

Switch from default typekits to instantiated typekits

@typespec/http-client - internal ✏️

Switch from default typekits to instantiated typekits

@typespec/http-server-js - internal ✏️

Switch from default typekits to instantiated typekits

@typespec/http - internal ✏️

Switch from default typekits to instantiated typekits

@typespec/openapi3 - internal ✏️

Switch from default typekits to instantiated typekits

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 17, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin
Copy link
Member

Probably need also a typespec-azure pr before

@chrisradek
Copy link
Member Author

Probably need also a typespec-azure pr before

Yep, it's here: Azure/typespec-azure#2550

@chrisradek chrisradek enabled auto-merge April 18, 2025 17:30
@chrisradek chrisradek added this pull request to the merge queue Apr 18, 2025
Merged via the queue into microsoft:main with commit e37440d Apr 18, 2025
22 checks passed
@chrisradek chrisradek deleted the typekits-no-magic-program branch April 18, 2025 18:02
github-merge-queue bot pushed a commit to Azure/typespec-azure that referenced this pull request Apr 18, 2025
Depends on microsoft/typespec#7018

---------

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
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.

Typekits and the magic program
4 participants