diff --git a/.chronus/changes/extern-dec-type-2024-3-29-19-9-6.md b/.chronus/changes/extern-dec-type-2024-3-29-19-9-6.md new file mode 100644 index 0000000000..c644f781bf --- /dev/null +++ b/.chronus/changes/extern-dec-type-2024-3-29-19-9-6.md @@ -0,0 +1,16 @@ +--- +# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking +changeKind: internal +packages: + - "@typespec/compiler" + - "@typespec/http" + - "@typespec/json-schema" + - "@typespec/openapi" + - "@typespec/openapi3" + - "@typespec/protobuf" + - "@typespec/rest" + - "@typespec/versioning" + - "@typespec/xml" +--- + +Include `type` in generated extern dec diff --git a/packages/compiler/generated-defs/TypeSpec.ts-test.ts b/packages/compiler/generated-defs/TypeSpec.ts-test.ts index 965cc94cde..84b8407831 100644 --- a/packages/compiler/generated-defs/TypeSpec.ts-test.ts +++ b/packages/compiler/generated-defs/TypeSpec.ts-test.ts @@ -40,7 +40,7 @@ import { $withoutDefaultValues, $withoutOmittedProperties, } from "../src/index.js"; -import { +import type { DeprecatedDecorator, DiscriminatorDecorator, DocDecorator, diff --git a/packages/http/generated-defs/TypeSpec.Http.ts-test.ts b/packages/http/generated-defs/TypeSpec.Http.ts-test.ts index 6dfec87e9f..efd098a96a 100644 --- a/packages/http/generated-defs/TypeSpec.Http.ts-test.ts +++ b/packages/http/generated-defs/TypeSpec.Http.ts-test.ts @@ -19,7 +19,7 @@ import { $statusCode, $useAuth, } from "@typespec/http"; -import { +import type { BodyDecorator, BodyIgnoreDecorator, BodyRootDecorator, diff --git a/packages/json-schema/generated-defs/TypeSpec.JsonSchema.ts-test.ts b/packages/json-schema/generated-defs/TypeSpec.JsonSchema.ts-test.ts index 7361ba5b00..8e2778f71f 100644 --- a/packages/json-schema/generated-defs/TypeSpec.JsonSchema.ts-test.ts +++ b/packages/json-schema/generated-defs/TypeSpec.JsonSchema.ts-test.ts @@ -16,7 +16,7 @@ import { $prefixItems, $uniqueItems, } from "@typespec/json-schema"; -import { +import type { BaseUriDecorator, ContainsDecorator, ContentEncodingDecorator, diff --git a/packages/openapi/generated-defs/TypeSpec.OpenAPI.ts-test.ts b/packages/openapi/generated-defs/TypeSpec.OpenAPI.ts-test.ts index a0fec80b02..54e7d252a1 100644 --- a/packages/openapi/generated-defs/TypeSpec.OpenAPI.ts-test.ts +++ b/packages/openapi/generated-defs/TypeSpec.OpenAPI.ts-test.ts @@ -6,7 +6,7 @@ import { $info, $operationId, } from "@typespec/openapi"; -import { +import type { DefaultResponseDecorator, ExtensionDecorator, ExternalDocsDecorator, diff --git a/packages/openapi3/generated-defs/TypeSpec.OpenAPI.ts-test.ts b/packages/openapi3/generated-defs/TypeSpec.OpenAPI.ts-test.ts index 8e3d0ba59b..0286e8320d 100644 --- a/packages/openapi3/generated-defs/TypeSpec.OpenAPI.ts-test.ts +++ b/packages/openapi3/generated-defs/TypeSpec.OpenAPI.ts-test.ts @@ -1,6 +1,6 @@ /** An error here would mean that the decorator is not exported or doesn't have the right name. */ import { $oneOf, $useRef } from "@typespec/openapi3"; -import { OneOfDecorator, UseRefDecorator } from "./TypeSpec.OpenAPI.js"; +import type { OneOfDecorator, UseRefDecorator } from "./TypeSpec.OpenAPI.js"; type Decorators = { $oneOf: OneOfDecorator; diff --git a/packages/protobuf/generated-defs/TypeSpec.Protobuf.ts-test.ts b/packages/protobuf/generated-defs/TypeSpec.Protobuf.ts-test.ts index a03e753c7c..f6d84a8135 100644 --- a/packages/protobuf/generated-defs/TypeSpec.Protobuf.ts-test.ts +++ b/packages/protobuf/generated-defs/TypeSpec.Protobuf.ts-test.ts @@ -1,6 +1,6 @@ /** An error here would mean that the decorator is not exported or doesn't have the right name. */ import { $field, $message, $package, $reserve, $service, $stream } from "@typespec/protobuf"; -import { +import type { FieldDecorator, MessageDecorator, PackageDecorator, diff --git a/packages/rest/generated-defs/TypeSpec.Rest.ts-test.ts b/packages/rest/generated-defs/TypeSpec.Rest.ts-test.ts index 261e4c7197..d2e7e0bcc7 100644 --- a/packages/rest/generated-defs/TypeSpec.Rest.ts-test.ts +++ b/packages/rest/generated-defs/TypeSpec.Rest.ts-test.ts @@ -17,7 +17,7 @@ import { $segmentOf, $updatesResource, } from "@typespec/rest"; -import { +import type { ActionDecorator, ActionSeparatorDecorator, AutoRouteDecorator, diff --git a/packages/tspd/src/gen-extern-signatures/decorators-signatures.ts b/packages/tspd/src/gen-extern-signatures/decorators-signatures.ts index 7b52f11b36..bed1be65c8 100644 --- a/packages/tspd/src/gen-extern-signatures/decorators-signatures.ts +++ b/packages/tspd/src/gen-extern-signatures/decorators-signatures.ts @@ -34,7 +34,7 @@ export function generateSignatureTests( ]); content.push([ - "import {", + "import type {", decorators.map((x) => x.typeName).join(","), `} from "`, decoratorSignatureImport, diff --git a/packages/versioning/generated-defs/TypeSpec.Versioning.ts-test.ts b/packages/versioning/generated-defs/TypeSpec.Versioning.ts-test.ts index bea0ff5b97..f9fa0b2ed2 100644 --- a/packages/versioning/generated-defs/TypeSpec.Versioning.ts-test.ts +++ b/packages/versioning/generated-defs/TypeSpec.Versioning.ts-test.ts @@ -9,7 +9,7 @@ import { $useDependency, $versioned, } from "@typespec/versioning"; -import { +import type { AddedDecorator, MadeOptionalDecorator, RemovedDecorator, diff --git a/packages/xml/generated-defs/TypeSpec.Xml.ts-test.ts b/packages/xml/generated-defs/TypeSpec.Xml.ts-test.ts index f4648c5e89..14f4e8532e 100644 --- a/packages/xml/generated-defs/TypeSpec.Xml.ts-test.ts +++ b/packages/xml/generated-defs/TypeSpec.Xml.ts-test.ts @@ -1,6 +1,6 @@ /** An error here would mean that the decorator is not exported or doesn't have the right name. */ import { $attribute, $name, $ns, $nsDeclarations, $unwrapped } from "@typespec/xml"; -import { +import type { AttributeDecorator, NameDecorator, NsDeclarationsDecorator, diff --git a/packages/xml/src/testing/index.ts b/packages/xml/src/testing/index.ts index 9d90035633..6f4e37bebb 100644 --- a/packages/xml/src/testing/index.ts +++ b/packages/xml/src/testing/index.ts @@ -1,7 +1,7 @@ import { createTestLibrary, findTestPackageRoot, - TypeSpecTestLibrary, + type TypeSpecTestLibrary, } from "@typespec/compiler/testing"; export const XmlTestLibrary: TypeSpecTestLibrary = createTestLibrary({ diff --git a/packages/xml/tsconfig.json b/packages/xml/tsconfig.json index b73ccb236b..0192ea7806 100644 --- a/packages/xml/tsconfig.json +++ b/packages/xml/tsconfig.json @@ -5,6 +5,7 @@ "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", + "verbatimModuleSyntax": true, "lib": ["DOM", "ESNext"] }, "include": ["src/**/*.ts", "generated-defs/**/*.ts", "test/**/*.ts"]