Skip to content

April 2023

New Features

@typespec/compiler

  • Emit diagnostic when ambiguous symbol exists between global and usings
  • Add support for referencing metatypes ModelProperty ::type and Operation ::returnType and ::parameters
  • Relax constraint on derived type overrides
  • Prevent use of augment decorators on instantiated templates.
  • Allow projectedNames helpers to work with previous projections
  • Add helper interpolatePath for emitter to do additional interpolation on config properties
  • Api: Update getTypeName to omit standard library namespace
  • Allow overloads in interfaces to work under projection
  • Add pre-projection support
  • Provide access to extended interfaces in type graph
  • Document member ordering and fix projection rename reordering

@typespec/openapi3

  • Support shared routes
  • Update to use new interpolatePath logic to resolve the output-file

@typespec/migrate

  • Add migrate script for zonedDateTime
  • Add migration script for @header and @query format required

Bug Fixes

@typespec/compiler

  • Fix: emitter framework will now visit scalar declarations
  • Fix: Alias unknown ref crash
  • Fix: Empty model expression assignable to array
  • Fix: tsp code uninstall not finding extension to uninstall
  • Fix: Issue where template parameter type check wouldn’t work if constraint is exact same type as next validation

@typespec/rest

  • Fix: Issue where @action("") was treated the same as @action. Now this emits an error.

@typespec/versioning

  • Fix: Issue with using version as a template parameter across different namespaces. Includes a significant change in the versioning library internals.
  • Fix:Use pre-projections to fix issues with versioned resources.

VS Code extension

  • Fix: Highlighting of TypeSpec code blocks in markdown.

Breaking Changes

@typespec/versioning: Removed deprecated versioning symbols.

  • Removed @versionedDependency decorator. Use @useDependency instead.
  • Removed getRenamedFromVersion. Use getRenamedFromVersions instead.
  • Removed getRenamedFromOldName. Use getNameAtVersion instead.
  • Removed getAddedOn, addedAfter, getRemovedOn and removedOnOrBefore. Use existsAtVersion instead.
  • Removed renamedAfter. Use hasDifferentNameAtVersion instead.

@typespec/compiler: Removed zonedDateTime and replaced with utcDateTime and offsetDateTime

To disambiguate important time concepts and encourage best practice behavior in representing date-time types we removed zonedDateTime which was being used to represent a time with offset, and replaced it with two new types that are more precisely defined:

  • utcDateTime which represents a precise instant in time. This type should be used to represent time values given in coordinated universal time (UTC) and unix timestamps. This is the preferred mechanism for capturing dateTime in most service specifications.
  • offsetDateTime which represents a time with offset. Note that while this time contains an offset from UTC, it does not contain any additional time zone information.

Change instances of zonedDateTime to utcDateTime

Old
model MyModel {
createdAt: zonedDateTime;
}

New

model MyModel {
createdAt: utcDateTime;
}

Use the (experimental) Migration tool to make this change

The (experimental) migration tool will automatically migrate instances of zonedDateTime to utcDateTime. To perform all migrations in a TypeSpec or Cadl specification package, execute:

Terminal window
npx @typespec/migrate

If you would like to execute from a different folder or don’t have a package.json that indicates compiler package versions, please see command line options:

Terminal window
npx @typespec/migrate --help

@typespec/http: Removed header and query default format

@header and @query no longer default the format to csv and multi respectively. A value must now be provided when the type is an array. The migration tool can also be used to make this change.

@typespec/lint: Removed global state

Rules from another library can no longer be enabled on a LibraryLinter.