| Name | Modified | Size | Downloads / 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, andscalardeclarations to be used as expressions. A declaration used in expression position has its corresponding type marked withexpression: trueand 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, andscalardeclarations 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, orscalardeclaration expression, just like an inline@docdecorator.
tsp
model Foo {
status: /** the current status */ enum { active, inactive };
}
- #11019 Improve formatting of declaration expressions (
model,enum,union, andscalarused 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.createnow produces an enum expression (expression: true) when given an emptyname, 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 compilefailing withINVALID_MODULE_EXPORT_TARGETwhen the project is on a Windows network share (UNC path). - #10613 Fix
Sym.nodetype to beNode | undefinedand updategetSymNodereturn type to accurately reflect that it may returnundefinedfor symbols created without a node (e.g. the built-innullsymbol). Update all callers to correctly handle theundefinedcase.
@typespec/http
Bug Fixes
- #12118 Fix
@statusCodeproperties that take their range from@minValueand@maxValueon a scalar or its base scalar, which were reported asstatus-code-invalid.
@typespec/openapi
Features
- #11019 Support
model,enum,union, andscalardeclarations 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, andscalardeclarations 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
additionalPropertiesfor aRecord<T>indexer, unless the model also extends another model or the schema is sealed, which still useunevaluatedProperties.
Bug Fixes
- #11735 [converter] Emit reusable models under a
Responsesnamespace 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
@encodeon nullable properties and parameters in OpenAPI 3.1 and 3.2. The encoding is now applied to theTmember ofanyOf: [T, { type: "null" }]instead of being written next toanyOf. When the encoding changed the emitted type, likeunixTimestamp,secondsor@encode(string)on a number, the old schema rejected every value. When the encoded type stayed a string, likerfc7231onutcDateTimeorbase64urlonbytes, it only rejectednull.bytes | nullnow also getscontentEncodinginstead offormat. - #12050 [converter] Escape quotes and line breaks in
@tagMetadatastrings generated from OpenAPI tags. - #11915 Emit tuple value referencing a declared model as a
$ref.
@typespec/json-schema
Features
- #11019 Support
model,enum,union, andscalardeclarations 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
minItemsandmaxItemsfor 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.