Skip to content

feat(compiler): Add interface typekit ($.interface)#9771

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/add-interface-typekit
Closed

feat(compiler): Add interface typekit ($.interface)#9771
Copilot wants to merge 2 commits intomainfrom
copilot/add-interface-typekit

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

Interfaces were the only major TypeSpec type without a corresponding typekit entry. This adds $.interface with create and is methods, consistent with existing kits for model, operation, enum, etc.

Changes

  • kits/interface.ts — New InterfaceKit with:
    • create(desc: InterfaceDescriptor): Interface — builds a finished Interface type, optionally with pre-built operations
    • is(type: Entity): type is Interface — type guard
  • kits/index.ts / typekit/index.ts — Export InterfaceKit and InterfaceDescriptor
  • test/typekit/interface.test.ts — Tests for is, create (empty), and create with operations

Usage

const op = $(program).operation.create({
  name: "list",
  parameters: [],
  returnType: $(program).intrinsic.void,
});

const iface = $(program).interface.create({
  name: "PetService",
  operations: [op],
});

$(program).interface.is(iface); // true
iface.operations.get("list");   // op, with op.interface === iface
Original prompt

This section details on the original issue you should resolve

<issue_title>[compiler] There is no typekit for interfaces</issue_title>
<issue_description>### Clear and concise description of the problem

This seems like an oversight. We have typekits for everything else, but none for making an interface.

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.</issue_description>

<agent_instructions>Follow the examples of other typekits in packages/compiler/src/typekit/kits to create a versatile typekit for creating instances of interfaces.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: witemple-msft <77019085+witemple-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the compiler:core Issues for @typespec/compiler label Feb 23, 2026
Copilot AI changed the title [WIP] Add typekit for creating interfaces feat(compiler): Add interface typekit ($.interface) Feb 23, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 23, 2026

Open in StackBlitz

npm i https://pkg.pr.new/microsoft/typespec/@typespec/compiler@9771

commit: 7903666

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Mar 26, 2026
@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

Hi @@copilot. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

Hi @@copilot. The PR will be closed since the PR has no update for 60 days. If this is still relevant please reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:core Issues for @typespec/compiler stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[compiler] There is no typekit for interfaces

2 participants