Download Latest Version typespec-stable@1.17.0 source code.zip (32.8 MB) Google Add to Preferred Sources
Home / typespec-stable@1.17.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-10-07 7.5 kB
typespec-stable@1.17.0 source code.tar.gz 2026-10-07 20.5 MB
typespec-stable@1.17.0 source code.zip 2026-10-07 32.8 MB
Totals: 3 Items   53.3 MB 0

@typespec/compiler

Features

  • #11019 Allow model, enum, union, and scalar declarations to be used as expressions. A declaration used in expression position has its corresponding type marked with expression: true and is not registered in the enclosing namespace. It may be named or anonymous (in which case it has no name).

This is an experimental feature that must be opted into by adding declaration-expressions to the features list in tspconfig.yaml; using a declaration expression without it reports a declaration-expression-disabled error.

They can be used anywhere an expression is expected, including aliases, model properties, decorator arguments, template arguments, function/call arguments, and tuples.

model, scalar, and union declaration expressions support the same extends clause as their statement form (union extends additionally requires the union-extends feature).

```tsp alias Foo = enum { a, b, };

model Bar { status: enum { active, inactive }; unit: scalar extends string; inner: model Inner { x: string }; }

@Versioning.versioned(enum Versions { v1, v2 }) namespace MyService; ```

  • #11019 Allow decorators to be applied to model, enum, union, and scalar declarations used in expression position. Inline decorators can be applied directly, and augment decorators (@@) can target them through a navigation reference (such as ::type).

```tsp model Foo { status: @doc("the current status") enum { active, inactive }; inner: @doc("nested model") model Inner { x: string }; }

@@doc(Foo.status::type, "the current status"); ```

  • #11019 Allow a doc comment to be applied inline to a model, enum, union, or scalar declaration expression, just like an inline @doc decorator.

tsp model Foo { status: /** the current status */ enum { active, inactive }; }

  • #11019 Improve formatting of declaration expressions (model, enum, union, and scalar used in expression position) that carry doc comments and/or decorators. When the inline form would exceed the print width, the doc comments and decorators are now each placed on their own line and the whole block is indented one level instead of overflowing.

tsp model Foo { status: @summary("a fairly long summary text here") @example("some-default-example-value") enum { active, inactive, }; }

  • #11019 $.enum.create now produces an enum expression (expression: true) when given an empty name, mirroring $.model.create.

Bug Fixes

  • #11559 Disallow property and record spreads in array model declarations.
  • #11960 Prevent TypeSpec-authored paths from escaping template and emitter output directories.
  • #11998 Fix tsp compile failing with INVALID_MODULE_EXPORT_TARGET when the project is on a Windows network share (UNC path).
  • #10613 Fix Sym.node type to be Node | undefined and update getSymNode return type to accurately reflect that it may return undefined for symbols created without a node (e.g. the built-in null symbol). Update all callers to correctly handle the undefined case.

@typespec/http

Bug Fixes

  • #12118 Fix @statusCode properties that take their range from @minValue and @maxValue on a scalar or its base scalar, which were reported as status-code-invalid.

@typespec/openapi

Features

  • #11019 Support model, enum, union, and scalar declarations used in expression position. Anonymous declaration expressions are inlined, while named ones are hoisted into a referenced component.

tsp model Foo { status: enum { active, inactive }; // inlined unit: scalar extends string; // inlined inner: model Inner { x: string }; // hoisted as component `Inner` }

@typespec/openapi3

Features

  • #11019 Support model, enum, union, and scalar declarations used in expression position. Anonymous declaration expressions are inlined, while named ones are hoisted into a referenced component.

tsp model Foo { status: enum { active, inactive }; // inlined unit: scalar extends string; // inlined inner: model Inner { x: string }; // hoisted as component `Inner` }

  • #11954 OpenAPI 3.1 and 3.2 now emit additionalProperties for a Record<T> indexer, unless the model also extends another model or the schema is sealed, which still use unevaluatedProperties.

Bug Fixes

  • #11735 [converter] Emit reusable models under a Responses namespace for #/components/responses/... references instead of inlining the response at each operation
  • #12042 [converter] Emit valid #deprecated directives for converted operation parameters.
  • #12020 Fix duplicate schema emitted for a template instantiation referenced by both an operation and an unreachable derived model
  • #12016 Fix @encode on nullable properties and parameters in OpenAPI 3.1 and 3.2. The encoding is now applied to the T member of anyOf: [T, { type: "null" }] instead of being written next to anyOf. When the encoding changed the emitted type, like unixTimestamp, seconds or @encode(string) on a number, the old schema rejected every value. When the encoded type stayed a string, like rfc7231 on utcDateTime or base64url on bytes, it only rejected null. bytes | null now also gets contentEncoding instead of format.
  • #12050 [converter] Escape quotes and line breaks in @tagMetadata strings generated from OpenAPI tags.
  • #11915 Emit tuple value referencing a declared model as a $ref.

@typespec/json-schema

Features

  • #11019 Support model, enum, union, and scalar declarations used in expression position. Anonymous declaration expressions are inlined, while named ones are hoisted into their own schema.

tsp model Foo { status: enum { active, inactive }; // inlined unit: scalar extends string; // inlined inner: model Inner { x: string }; // hoisted as `Inner.json` }

Bug Fixes

  • #11893 Emit minItems and maxItems for tuple types so generated schemas enforce the tuple's exact length.
  • #11915 Emit tuple value referencing a declared model as a $ref.

typespec-vscode

No changes, version bump only.

@typespec/prettier-plugin-typespec

No changes, version bump only.

Source: README.md, updated 2026-10-07