1.13.0
TypeSpec 1.13.0 introduces project-level configuration capabilities, expands compiler and OpenAPI authoring features, and includes a broad set of compiler, OpenAPI, and IDE fixes.
Deprecations
Section titled “Deprecations”@typespec/compiler
Section titled “@typespec/compiler”- Deprecated
deepCloneutility in favor ofstructuredClone. All internal usages have been replaced with the nativestructuredCloneAPI.
Features
Section titled “Features”@typespec/compiler
Section titled “@typespec/compiler”-
ApplyCodeFixExpect.toEqualnow acceptsRecord<string, string>to assert on multiple files after a code fix is applied. This enables testing code fixes that write to a different file (e.g., adding augment decorators to aclient.tsp).await ruleTester.expect({"main.tsp": `import "./client.tsp";\nmodel Foo { name: string; }`,"client.tsp": ``,}).applyCodeFix("add-client-override").toEqual({"client.tsp": `@@override(Foo.name, "clientName");\n`,}); -
Add
kind: projectandentrypointsupport totspconfig.yamlfor defining project boundaries and entrypoint resolution. See Project Configuration for more details.tspconfig.yaml kind: projectentrypoint: src/service.tspemit:- "@typespec/openapi3" -
Added support for accessing late-bound members on models that use template spreads or
isbases.Previously, accessing a member that was introduced via a template instantiation would fail with an
invalid-referror:model Template<T> {...T;}model Useris Template<{name: string;}>;alias UserName = User.name; // ❌ previously: "Model doesn't have member name"Now, the compiler will force-evaluate the container type when a member lookup fails on a model with unknown members (from template spreads or
is), making late-bound members accessible:model Template<T> {...T;}model Useris Template<{name: string;}>;alias UserName = User.name; // ✅ now resolves correctlyThis also works with:
- Forward references to the template definition
- Spread-based patterns (
model A { ...Template<{x: int32}> }) - Members added by augment decorators
- Circular references between models with late-bound members
-
The
internalmodifier is no longer experimental. Usinginternalwill no longer emit anexperimental-featurewarning, and#suppress "experimental-feature"directives are no longer needed. -
Add project-scoped compiler feature flags to
tspconfig.yaml. Compiler feature definitions are tracked internally with descriptions and can be listed withtsp info features.tspconfig.yaml kind: projectfeatures:- function-declarations -
Enabled resolution of member properties and metaproperties through template parameters based on constraints.
model Resource {id: string;}model Read<R extends Resource> {id: R.id;}
@typespec/openapi
Section titled “@typespec/openapi”-
Add
summaryandkindfields to@tagMetadatadecorator.For OpenAPI 3.2, these fields are emitted as native tag object fields. For OpenAPI 3.0/3.1, they are emitted as
x-oai-summaryandx-oai-kindextensions. The OpenAPI converter also supports importingx-oai-summary,x-oai-kind(from 3.0/3.1) and nativesummary,kind(from 3.2) back to TypeSpec.@tagMetadata("foo", #{ summary: "all operations that allow doing Foo", kind: "FooGroup" }) -
Add array form for
@tagMetadatadecorator to allow explicit control of tag declaration order.@service@tagMetadata(#[#{ name: "First Tag", description: "First tag description" },#{ name: "Second Tag", description: "Second tag description" }])namespace PetStore {}Using
@tagMetadata(#[...])and@tagMetadata("name", #{...})on the same namespace is a diagnostic error. -
Added a warning diagnostic when
@defaultResponseis used on a model that already has a@statusCodeproperty or is marked with@error.
@typespec/openapi3
Section titled “@typespec/openapi3”@typespec/openapi3includes the same@tagMetadataenhancements listed above for@typespec/openapi: support forsummary/kindmetadata and array-form tag declarations with validation for mixed usage.
Bug Fixes
Section titled “Bug Fixes”@typespec/compiler
Section titled “@typespec/compiler”- Fix spurious circular-base-type diagnostics after invalid ‘model is’ declarations.
- Fixed the compiler to correctly detect circular model spread chains while preserving support for recursive model-expression aliases.
- Fix wrongly detected circular reference with alias and model properties
- Completion in the middle of an identifier now replaces the full token instead of inserting and leaving trailing characters
- Language server fatal errors now write pending logs and the fatal stack trace directly to stderr so crash details remain visible.
- Report an error when a function is declared in the
$functionsmap in a JS file but has no correspondingextern fndeclaration in TypeSpec. Previously this would silently have no effect. - [Language Server] Wrapped LSP server handlers with
wrapUnhandledErrorto preserve server-side stack traces in error messages forwarded to the client. Previously, the JSON-RPC layer discarded the original stack trace, making unhandled errors in telemetry opaque. - Validate function rest arguments and report function call argument count diagnostics at call sites.
@typespec/openapi
Section titled “@typespec/openapi”- Reject duplicate tag names in @tagMetadata array form.
- Fix tagMetadata extension diagnostic targets
@typespec/openapi3
Section titled “@typespec/openapi3”-
Mark models as
@errorwhen imported from 4xx/5xx response body schema references. -
Fix import of
deprecated: trueon OpenAPI3 operations to generate#deprecated "deprecated"directive in converted TypeSpec output. -
Fix custom auth scheme models leaking into
components.schemaswhen declared inside the service namespace. They are now emitted only undercomponents.securitySchemesas expected. -
Propagate
@JsonSchema.uniqueItemsto query, path and header parameter schemas. The decorator was only applied to body model property schemas; for HTTP parameter schemas (which go throughapplyIntrinsicDecorators) it was silently dropped, so arrays declared on operation parameters never emitteduniqueItems: trueeven when the decorator was present.op listUsers(@query@JsonSchema.uniqueItems$select?: ("id" | "displayName")[],): User[];
typespec-vscode
Section titled “typespec-vscode”- Improved telemetry instrumentation for
install-global-compiler-cli,preview-openapi3,start-server, andserver-path-changedevents by adding missinglastSteptracking and error detail logging. Added actionable error message when compiler is found but neithernodenortspis available on PATH, guiding users to fix common nvm/fnm/volta configuration issues.