diff --git a/.chronus/changes/type-import-emitter-java-2026-7-31.md b/.chronus/changes/type-import-emitter-java-2026-7-31.md new file mode 100644 index 00000000000..30858f5275c --- /dev/null +++ b/.chronus/changes/type-import-emitter-java-2026-7-31.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-java" +--- + +Enable `verbatimModuleSyntax` in the emitter's TypeScript config and convert type-only imports/exports to `import type`/`export type`. diff --git a/eng/emitter-diff/tsconfig.json b/eng/emitter-diff/tsconfig.json index b3d26e962d3..580b1d1d327 100644 --- a/eng/emitter-diff/tsconfig.json +++ b/eng/emitter-diff/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "noEmit": true, - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true + "allowImportingTsExtensions": true }, "include": ["src/**/*.ts"] } diff --git a/packages/asset-emitter/tsconfig.json b/packages/asset-emitter/tsconfig.json index 8d0eb2d00d4..3dc7c231583 100644 --- a/packages/asset-emitter/tsconfig.json +++ b/packages/asset-emitter/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", - "verbatimModuleSyntax": true + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/astro-utils/tsconfig.json b/packages/astro-utils/tsconfig.json index f6f8ae45785..c793aabc0f0 100644 --- a/packages/astro-utils/tsconfig.json +++ b/packages/astro-utils/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "astro/tsconfigs/strict", "compilerOptions": { - "jsx": "preserve", - "verbatimModuleSyntax": true + "jsx": "preserve" }, "exclude": ["dist/"] } diff --git a/packages/best-practices/tsconfig.json b/packages/best-practices/tsconfig.json index 17a050101ce..3dc7c231583 100644 --- a/packages/best-practices/tsconfig.json +++ b/packages/best-practices/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/bundle-uploader/tsconfig.json b/packages/bundle-uploader/tsconfig.json index c518e28e5bf..84433f97361 100644 --- a/packages/bundle-uploader/tsconfig.json +++ b/packages/bundle-uploader/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/bundler/tsconfig.json b/packages/bundler/tsconfig.json index 4fbc77e4573..be487b204db 100644 --- a/packages/bundler/tsconfig.json +++ b/packages/bundler/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }, { "path": "../rest/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", diff --git a/packages/compiler/tsconfig.json b/packages/compiler/tsconfig.json index da9dc30b278..84433f97361 100644 --- a/packages/compiler/tsconfig.json +++ b/packages/compiler/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "verbatimModuleSyntax": true, "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/emitter-framework/tsconfig.json b/packages/emitter-framework/tsconfig.json index ba1845c0d4d..f896e410c45 100644 --- a/packages/emitter-framework/tsconfig.json +++ b/packages/emitter-framework/tsconfig.json @@ -15,7 +15,6 @@ "emitDeclarationOnly": true, "outDir": "dist", "rootDir": "./", - "verbatimModuleSyntax": true, "types": ["node", "@alloy-js/core/testing/matchers"] }, "include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"], diff --git a/packages/events/tsconfig.json b/packages/events/tsconfig.json index 8d0eb2d00d4..3dc7c231583 100644 --- a/packages/events/tsconfig.json +++ b/packages/events/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", - "verbatimModuleSyntax": true + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/graphql/tsconfig.json b/packages/graphql/tsconfig.json index 9a6bdaa9fe7..ca22f6c8d13 100644 --- a/packages/graphql/tsconfig.json +++ b/packages/graphql/tsconfig.json @@ -7,7 +7,6 @@ "target": "es2022", "skipLibCheck": true, "isolatedModules": true, - "verbatimModuleSyntax": true, "jsx": "preserve", "jsxImportSource": "@alloy-js/core", "emitDeclarationOnly": true, diff --git a/packages/html-program-viewer/tsconfig.json b/packages/html-program-viewer/tsconfig.json index d8b0d916bff..a8bbbca8c93 100644 --- a/packages/html-program-viewer/tsconfig.json +++ b/packages/html-program-viewer/tsconfig.json @@ -9,7 +9,6 @@ "sourceMap": false, "resolveJsonModule": true, "skipLibCheck": true, - "verbatimModuleSyntax": true, "jsx": "react-jsx", "lib": ["DOM", "ES2022"], "types": ["vite/client", "@testing-library/jest-dom"] diff --git a/packages/http-canonicalization/tsconfig.json b/packages/http-canonicalization/tsconfig.json index 9ef83ba5ee3..fa92645c2a7 100644 --- a/packages/http-canonicalization/tsconfig.json +++ b/packages/http-canonicalization/tsconfig.json @@ -12,7 +12,6 @@ "declarationMap": true, "outDir": "dist", "rootDir": "./", - "verbatimModuleSyntax": true, "types": ["node"] }, "exclude": ["node_modules", "dist"] diff --git a/packages/http-client-csharp/emitter/tsconfig.json b/packages/http-client-csharp/emitter/tsconfig.json index c6423567066..5bec36bfff7 100644 --- a/packages/http-client-csharp/emitter/tsconfig.json +++ b/packages/http-client-csharp/emitter/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../../tsconfig.base.json", "compilerOptions": { - "noEmit": true, - "verbatimModuleSyntax": true + "noEmit": true }, "include": ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts", "../generated-defs/**/*.ts"] } diff --git a/packages/http-client-java/emitter/src/code-model-builder.ts b/packages/http-client-java/emitter/src/code-model-builder.ts index 206efcea876..a8c3d461921 100644 --- a/packages/http-client-java/emitter/src/code-model-builder.ts +++ b/packages/http-client-java/emitter/src/code-model-builder.ts @@ -1,3 +1,4 @@ +import type { Schema, SecurityScheme } from "@autorest/codemodel"; import { AnySchema, ApiVersion, @@ -29,11 +30,9 @@ import { Property, Relations, Response, - Schema, SchemaResponse, SchemaType, Security, - SecurityScheme, SerializationStyle, StringSchema, TimeSchema, @@ -43,10 +42,9 @@ import { VirtualParameter, } from "@autorest/codemodel"; import { KnownMediaType } from "@azure-tools/codegen"; -import { +import type { CreateSdkContextOptions, DecoratedType, - InitializedByFlags, SdkArrayType, SdkBodyParameter, SdkBuiltInType, @@ -71,6 +69,9 @@ import { SdkServiceMethod, SdkType, SdkUnionType, +} from "@azure-tools/typespec-client-generator-core"; +import { + InitializedByFlags, UsageFlags, createSdkContext, getAllModels, @@ -81,16 +82,18 @@ import { isSdkBuiltInKind, isSdkIntKind, } from "@azure-tools/typespec-client-generator-core"; -import { +import type { EmitContext, Interface, Namespace, - NoTarget, Operation, Program, Type, TypeNameOptions, Union, +} from "@typespec/compiler"; +import { + NoTarget, getDoc, getNamespaceFullName, getOverloadedOperation, @@ -99,23 +102,13 @@ import { isRecordModelType, listServices, } from "@typespec/compiler"; -import { - Authentication, - HttpStatusCodeRange, - HttpStatusCodesEntry, - Visibility, - getAuthentication, -} from "@typespec/http"; +import type { Authentication, HttpStatusCodeRange, HttpStatusCodesEntry } from "@typespec/http"; +import { Visibility, getAuthentication } from "@typespec/http"; import { getSegment } from "@typespec/rest"; import { getAddedOnVersions } from "@typespec/versioning"; import { fail } from "assert"; -import { - Client as CodeModelClient, - EncodedProperty, - EncodedSchema, - PageableContinuationToken, - Serializable, -} from "./common/client.js"; +import type { EncodedProperty, EncodedSchema, Serializable } from "./common/client.js"; +import { Client as CodeModelClient, PageableContinuationToken } from "./common/client.js"; import { CodeModel } from "./common/code-model.js"; import { LongRunningMetadata } from "./common/long-running-metadata.js"; import { Operation as CodeModelOperation, ConvenienceApi, Request } from "./common/operation.js"; @@ -123,7 +116,8 @@ import { ChoiceSchema, SealedChoiceSchema } from "./common/schemas/choice.js"; import { ConstantSchema, ConstantValue } from "./common/schemas/constant.js"; import { OrSchema } from "./common/schemas/relationship.js"; import { DurationSchema } from "./common/schemas/time.js"; -import { SchemaContext, SchemaUsage } from "./common/schemas/usage.js"; +import type { SchemaUsage } from "./common/schemas/usage.js"; +import { SchemaContext } from "./common/schemas/usage.js"; import { createPollOperationDetailsSchema, getFileDetailsSchema } from "./external-schemas.js"; import { createDiagnostic, reportDiagnostic } from "./lib.js"; import { ClientContext } from "./models.js"; @@ -140,7 +134,8 @@ import { operationIsMultipart, operationIsMultipleContentTypes, } from "./operation-utils.js"; -import { DevOptions, EmitterOptions, LIB_NAME } from "./options.js"; +import type { DevOptions, EmitterOptions } from "./options.js"; +import { LIB_NAME } from "./options.js"; import { BYTES_KNOWN_ENCODING, DATETIME_KNOWN_ENCODING, diff --git a/packages/http-client-java/emitter/src/common/client.ts b/packages/http-client-java/emitter/src/common/client.ts index 6536c438dba..35bce07fee6 100644 --- a/packages/http-client-java/emitter/src/common/client.ts +++ b/packages/http-client-java/emitter/src/common/client.ts @@ -1,16 +1,9 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ -import { - Aspect, - HttpHeader, - Metadata, - OperationGroup, - Parameter, - Property, - Security, -} from "@autorest/codemodel"; -import { DeepPartial } from "@azure-tools/codegen"; -import { ArrayKnownEncoding } from "@azure-tools/typespec-client-generator-core"; -import { XmlSerializationFormat } from "./formats/xml.js"; +import type { HttpHeader, OperationGroup, Parameter, Property } from "@autorest/codemodel"; +import { Aspect, Metadata, Security } from "@autorest/codemodel"; +import type { DeepPartial } from "@azure-tools/codegen"; +import type { ArrayKnownEncoding } from "@azure-tools/typespec-client-generator-core"; +import type { XmlSerializationFormat } from "./formats/xml.js"; export interface Client extends Aspect { /** All operations */ diff --git a/packages/http-client-java/emitter/src/common/code-model.ts b/packages/http-client-java/emitter/src/common/code-model.ts index a4f9b09b7c8..c9a60673de5 100644 --- a/packages/http-client-java/emitter/src/common/code-model.ts +++ b/packages/http-client-java/emitter/src/common/code-model.ts @@ -1,7 +1,9 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ -import { Info, Metadata, OperationGroup, Parameter, Schemas, Security } from "@autorest/codemodel"; -import { DeepPartial, enableSourceTracking } from "@azure-tools/codegen"; -import { Client } from "./client.js"; +import type { Parameter } from "@autorest/codemodel"; +import { Info, Metadata, OperationGroup, Schemas, Security } from "@autorest/codemodel"; +import type { DeepPartial } from "@azure-tools/codegen"; +import { enableSourceTracking } from "@azure-tools/codegen"; +import type { Client } from "./client.js"; /** the model that contains all the information required to generate a service api */ export interface CodeModel extends Metadata { diff --git a/packages/http-client-java/emitter/src/common/formats/xml.ts b/packages/http-client-java/emitter/src/common/formats/xml.ts index 4b05d8cc1ec..446215b03e1 100644 --- a/packages/http-client-java/emitter/src/common/formats/xml.ts +++ b/packages/http-client-java/emitter/src/common/formats/xml.ts @@ -1,4 +1,4 @@ -import { SerializationFormat } from "@autorest/codemodel"; +import type { SerializationFormat } from "@autorest/codemodel"; export interface XmlSerializationFormat extends SerializationFormat { name?: string; diff --git a/packages/http-client-java/emitter/src/common/long-running-metadata.ts b/packages/http-client-java/emitter/src/common/long-running-metadata.ts index 0618aa454ca..d4de1010c70 100644 --- a/packages/http-client-java/emitter/src/common/long-running-metadata.ts +++ b/packages/http-client-java/emitter/src/common/long-running-metadata.ts @@ -1,4 +1,4 @@ -import { Metadata, Schema } from "@autorest/codemodel"; +import type { Metadata, Schema } from "@autorest/codemodel"; export class LongRunningMetadata { longRunning: boolean = false; diff --git a/packages/http-client-java/emitter/src/common/operation.ts b/packages/http-client-java/emitter/src/common/operation.ts index f65b3173636..430c6013259 100644 --- a/packages/http-client-java/emitter/src/common/operation.ts +++ b/packages/http-client-java/emitter/src/common/operation.ts @@ -1,15 +1,8 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ -import { - ApiVersion, - Aspect, - ImplementationLocation, - Metadata, - Parameter, - Response, - SchemaType, -} from "@autorest/codemodel"; -import { DeepPartial } from "@azure-tools/codegen"; -import { LongRunningMetadata } from "./long-running-metadata.js"; +import type { ApiVersion, Parameter, Response } from "@autorest/codemodel"; +import { Aspect, ImplementationLocation, Metadata, SchemaType } from "@autorest/codemodel"; +import type { DeepPartial } from "@azure-tools/codegen"; +import type { LongRunningMetadata } from "./long-running-metadata.js"; /** represents a single callable endpoint with a discrete set of inputs, and any number of output possibilities (responses or exceptions) */ export interface Operation extends Aspect { diff --git a/packages/http-client-java/emitter/src/common/schemas/choice.ts b/packages/http-client-java/emitter/src/common/schemas/choice.ts index 867460486a1..ce3c01a7e21 100644 --- a/packages/http-client-java/emitter/src/common/schemas/choice.ts +++ b/packages/http-client-java/emitter/src/common/schemas/choice.ts @@ -1,14 +1,8 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ -import { - ChoiceValue, - PrimitiveSchema, - Schema, - SchemaType, - StringSchema, - ValueSchema, -} from "@autorest/codemodel"; -import { DeepPartial } from "@azure-tools/codegen"; -import { SchemaUsage } from "./usage.js"; +import type { ChoiceValue, PrimitiveSchema, StringSchema, ValueSchema } from "@autorest/codemodel"; +import { Schema, SchemaType } from "@autorest/codemodel"; +import type { DeepPartial } from "@azure-tools/codegen"; +import type { SchemaUsage } from "./usage.js"; /** a schema that represents a choice of several values (ie, an 'enum') */ export interface ChoiceSchema diff --git a/packages/http-client-java/emitter/src/common/schemas/constant.ts b/packages/http-client-java/emitter/src/common/schemas/constant.ts index 6af7b23aed2..d0c927421f8 100644 --- a/packages/http-client-java/emitter/src/common/schemas/constant.ts +++ b/packages/http-client-java/emitter/src/common/schemas/constant.ts @@ -1,7 +1,9 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ -import { Extensions, Languages, Schema, SchemaType } from "@autorest/codemodel"; -import { DeepPartial, Initializer } from "@azure-tools/codegen"; -import { SchemaUsage } from "./usage.js"; +import type { Extensions, Languages } from "@autorest/codemodel"; +import { Schema, SchemaType } from "@autorest/codemodel"; +import type { DeepPartial } from "@azure-tools/codegen"; +import { Initializer } from "@azure-tools/codegen"; +import type { SchemaUsage } from "./usage.js"; /** a container for the actual constant value */ export interface ConstantValue extends Extensions { diff --git a/packages/http-client-java/emitter/src/common/schemas/relationship.ts b/packages/http-client-java/emitter/src/common/schemas/relationship.ts index ec64155d5e0..5d4ce838309 100644 --- a/packages/http-client-java/emitter/src/common/schemas/relationship.ts +++ b/packages/http-client-java/emitter/src/common/schemas/relationship.ts @@ -1,7 +1,8 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ -import { ComplexSchema, ObjectSchema, Schema, SchemaType } from "@autorest/codemodel"; -import { DeepPartial } from "@azure-tools/codegen"; -import { SchemaUsage } from "./usage.js"; +import type { ComplexSchema, ObjectSchema } from "@autorest/codemodel"; +import { Schema, SchemaType } from "@autorest/codemodel"; +import type { DeepPartial } from "@azure-tools/codegen"; +import type { SchemaUsage } from "./usage.js"; /** an OR relationship between several schemas * diff --git a/packages/http-client-java/emitter/src/common/schemas/time.ts b/packages/http-client-java/emitter/src/common/schemas/time.ts index d31935122a5..02e5a3602f8 100644 --- a/packages/http-client-java/emitter/src/common/schemas/time.ts +++ b/packages/http-client-java/emitter/src/common/schemas/time.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ import { PrimitiveSchema, SchemaType } from "@autorest/codemodel"; -import { DeepPartial } from "@azure-tools/codegen"; +import type { DeepPartial } from "@azure-tools/codegen"; /** a schema that represents a Duration value */ export interface DurationSchema extends PrimitiveSchema { diff --git a/packages/http-client-java/emitter/src/common/schemas/usage.ts b/packages/http-client-java/emitter/src/common/schemas/usage.ts index fa16911048f..65641f40643 100644 --- a/packages/http-client-java/emitter/src/common/schemas/usage.ts +++ b/packages/http-client-java/emitter/src/common/schemas/usage.ts @@ -1,4 +1,4 @@ -import { KnownMediaType } from "@azure-tools/codegen"; +import type { KnownMediaType } from "@azure-tools/codegen"; export enum SchemaContext { /** Schema is used as an input to an operation. */ diff --git a/packages/http-client-java/emitter/src/emitter.ts b/packages/http-client-java/emitter/src/emitter.ts index 190ed7ec3c6..790c3d4d93a 100644 --- a/packages/http-client-java/emitter/src/emitter.ts +++ b/packages/http-client-java/emitter/src/emitter.ts @@ -1,18 +1,14 @@ -import { - EmitContext, - getNormalizedAbsolutePath, - NoTarget, - Program, - resolvePath, -} from "@typespec/compiler"; +import type { EmitContext, Program } from "@typespec/compiler"; +import { getNormalizedAbsolutePath, NoTarget, resolvePath } from "@typespec/compiler"; import { promises } from "fs"; import { dirname } from "path"; import { fileURLToPath } from "url"; import { stringify } from "yaml"; -import { CodeModelBuilder, EmitterOptionsDev } from "./code-model-builder.js"; -import { CodeModel } from "./common/code-model.js"; +import type { EmitterOptionsDev } from "./code-model-builder.js"; +import { CodeModelBuilder } from "./code-model-builder.js"; +import type { CodeModel } from "./common/code-model.js"; import { LibName, reportDiagnostic } from "./lib.js"; -import { EmitterOptions } from "./options.js"; +import type { EmitterOptions } from "./options.js"; import { DiagnosticError, spawnAsync, SpawnError, trace } from "./utils.js"; import { validateDependencies } from "./validate.js"; diff --git a/packages/http-client-java/emitter/src/external-schemas.ts b/packages/http-client-java/emitter/src/external-schemas.ts index df28619749d..46d0be7e653 100644 --- a/packages/http-client-java/emitter/src/external-schemas.ts +++ b/packages/http-client-java/emitter/src/external-schemas.ts @@ -1,14 +1,7 @@ -import { - ArraySchema, - BinarySchema, - ObjectSchema, - Property, - Schema, - Schemas, - StringSchema, -} from "@autorest/codemodel"; +import type { BinarySchema, Schema, Schemas, StringSchema } from "@autorest/codemodel"; +import { ArraySchema, ObjectSchema, Property } from "@autorest/codemodel"; import { KnownMediaType } from "@azure-tools/codegen"; -import { +import type { SdkModelPropertyType, SdkModelType, SdkType, diff --git a/packages/http-client-java/emitter/src/index.ts b/packages/http-client-java/emitter/src/index.ts index 7124d215111..9aa09b2e568 100644 --- a/packages/http-client-java/emitter/src/index.ts +++ b/packages/http-client-java/emitter/src/index.ts @@ -2,4 +2,4 @@ export { $onEmit } from "./emitter.js"; // emit options interface is required to be exported export { $lib } from "./lib.js"; -export { DevOptions, EmitterOptions } from "./options.js"; +export type { DevOptions, EmitterOptions } from "./options.js"; diff --git a/packages/http-client-java/emitter/src/models.ts b/packages/http-client-java/emitter/src/models.ts index 736c03a55dd..8b59432b683 100644 --- a/packages/http-client-java/emitter/src/models.ts +++ b/packages/http-client-java/emitter/src/models.ts @@ -1,6 +1,7 @@ -import { ApiVersions, Parameter } from "@autorest/codemodel"; -import { ModelProperty, Namespace, Operation, Program } from "@typespec/compiler"; -import { findVersionedNamespace, getVersions, Version } from "@typespec/versioning"; +import type { ApiVersions, Parameter } from "@autorest/codemodel"; +import type { ModelProperty, Namespace, Operation, Program } from "@typespec/compiler"; +import type { Version } from "@typespec/versioning"; +import { findVersionedNamespace, getVersions } from "@typespec/versioning"; import { getFilteredApiVersions, InconsistentVersions, diff --git a/packages/http-client-java/emitter/src/operation-utils.ts b/packages/http-client-java/emitter/src/operation-utils.ts index 1b130748324..385a8cc64d9 100644 --- a/packages/http-client-java/emitter/src/operation-utils.ts +++ b/packages/http-client-java/emitter/src/operation-utils.ts @@ -1,5 +1,6 @@ -import { ObjectSchema, Parameter, Property, SchemaResponse } from "@autorest/codemodel"; -import { +import type { Property } from "@autorest/codemodel"; +import { ObjectSchema, Parameter, SchemaResponse } from "@autorest/codemodel"; +import type { SdkCookieParameter, SdkHeaderParameter, SdkHttpOperation, @@ -9,11 +10,12 @@ import { SdkQueryParameter, SdkServiceResponseHeader, } from "@azure-tools/typespec-client-generator-core"; -import { Operation, Program, Type, Union } from "@typespec/compiler"; -import { HttpOperation } from "@typespec/http"; -import { Client as CodeModelClient, ServiceVersion } from "./common/client.js"; -import { CodeModel } from "./common/code-model.js"; -import { Operation as CodeModelOperation } from "./common/operation.js"; +import type { Operation, Program, Type, Union } from "@typespec/compiler"; +import type { HttpOperation } from "@typespec/http"; +import type { Client as CodeModelClient } from "./common/client.js"; +import { ServiceVersion } from "./common/client.js"; +import type { CodeModel } from "./common/code-model.js"; +import type { Operation as CodeModelOperation } from "./common/operation.js"; import { getPropertySerializedName, modelIs, unionReferredByType } from "./type-utils.js"; import { getNamespace, pascalCase } from "./utils.js"; diff --git a/packages/http-client-java/emitter/src/options.ts b/packages/http-client-java/emitter/src/options.ts index 8371d18e6aa..a825f378502 100644 --- a/packages/http-client-java/emitter/src/options.ts +++ b/packages/http-client-java/emitter/src/options.ts @@ -1,5 +1,5 @@ import { UnbrandedSdkEmitterOptions } from "@azure-tools/typespec-client-generator-core"; -import { JSONSchemaType } from "@typespec/compiler"; +import type { JSONSchemaType } from "@typespec/compiler"; // typespec-java has another "options.ts" file, with same "export". // If add/remove "export" here, please also check typespec-java in autorest.java repository. diff --git a/packages/http-client-java/emitter/src/type-utils.ts b/packages/http-client-java/emitter/src/type-utils.ts index 56798593434..318af4f3c01 100644 --- a/packages/http-client-java/emitter/src/type-utils.ts +++ b/packages/http-client-java/emitter/src/type-utils.ts @@ -1,14 +1,13 @@ import { getUnionAsEnum } from "@azure-tools/typespec-azure-core"; -import { +import type { SdkDurationType, SdkEnumType, SdkModelPropertyType, SdkModelType, SdkType, - isSdkFloatKind, - isSdkIntKind, } from "@azure-tools/typespec-client-generator-core"; -import { +import { isSdkFloatKind, isSdkIntKind } from "@azure-tools/typespec-client-generator-core"; +import type { DecoratedType, DecoratorApplication, EnumMember, @@ -23,14 +22,16 @@ import { TypeNameOptions, Union, Value, +} from "@typespec/compiler"; +import { getTypeName, isNullType, isTemplateDeclaration, isTemplateInstance, isTypeSpecValueTypeOf, } from "@typespec/compiler"; -import { XmlSerializationFormat } from "./common/formats/xml.js"; -import { DurationSchema } from "./common/schemas/time.js"; +import type { XmlSerializationFormat } from "./common/formats/xml.js"; +import type { DurationSchema } from "./common/schemas/time.js"; import { SchemaContext } from "./common/schemas/usage.js"; import { getNamespace } from "./utils.js"; diff --git a/packages/http-client-java/emitter/src/utils.ts b/packages/http-client-java/emitter/src/utils.ts index f42320d8e67..fa9a9097f55 100644 --- a/packages/http-client-java/emitter/src/utils.ts +++ b/packages/http-client-java/emitter/src/utils.ts @@ -1,5 +1,6 @@ -import { Diagnostic, Program, Type } from "@typespec/compiler"; -import { spawn, SpawnOptions } from "child_process"; +import type { Diagnostic, Program, Type } from "@typespec/compiler"; +import type { SpawnOptions } from "child_process"; +import { spawn } from "child_process"; export function trace(program: Program, msg: string) { program.trace("http-client-java", msg); diff --git a/packages/http-client-java/emitter/src/validate.ts b/packages/http-client-java/emitter/src/validate.ts index 6655cdddc35..929cc89b65f 100644 --- a/packages/http-client-java/emitter/src/validate.ts +++ b/packages/http-client-java/emitter/src/validate.ts @@ -1,4 +1,5 @@ -import { NoTarget, Program } from "@typespec/compiler"; +import type { Program } from "@typespec/compiler"; +import { NoTarget } from "@typespec/compiler"; import { reportDiagnostic } from "./lib.js"; import { spawnAsync, trace } from "./utils.js"; diff --git a/packages/http-client-java/emitter/src/versioning-utils.ts b/packages/http-client-java/emitter/src/versioning-utils.ts index 60f3c7945ad..a304c1ba7ef 100644 --- a/packages/http-client-java/emitter/src/versioning-utils.ts +++ b/packages/http-client-java/emitter/src/versioning-utils.ts @@ -1,7 +1,8 @@ import { isPreviewVersion } from "@azure-tools/typespec-azure-core"; -import { SdkClientType, SdkHttpOperation } from "@azure-tools/typespec-client-generator-core"; -import { Namespace, Program } from "@typespec/compiler"; -import { findVersionedNamespace, getVersions, Version } from "@typespec/versioning"; +import type { SdkClientType, SdkHttpOperation } from "@azure-tools/typespec-client-generator-core"; +import type { Namespace, Program } from "@typespec/compiler"; +import type { Version } from "@typespec/versioning"; +import { findVersionedNamespace, getVersions } from "@typespec/versioning"; /** * Sentinel values that describe a client that not have consistent api-versions. diff --git a/packages/http-client-js/tsconfig.json b/packages/http-client-js/tsconfig.json index 3137cbcff98..41ee4cca1cf 100644 --- a/packages/http-client-js/tsconfig.json +++ b/packages/http-client-js/tsconfig.json @@ -6,7 +6,6 @@ "target": "es2022", "skipLibCheck": true, "isolatedModules": true, - "verbatimModuleSyntax": true, "jsx": "preserve", "jsxImportSource": "@alloy-js/core", "emitDeclarationOnly": true, diff --git a/packages/http-client-python/emitter/tsconfig.json b/packages/http-client-python/emitter/tsconfig.json index 345bb3f8ee1..99589e3efe4 100644 --- a/packages/http-client-python/emitter/tsconfig.json +++ b/packages/http-client-python/emitter/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.base.json", "compilerOptions": { "noEmit": true, - "resolveJsonModule": true, - "verbatimModuleSyntax": true + "resolveJsonModule": true }, "include": ["src/**/*"] } diff --git a/packages/http-client/tsconfig.json b/packages/http-client/tsconfig.json index 671b5d1a980..9a813828d81 100644 --- a/packages/http-client/tsconfig.json +++ b/packages/http-client/tsconfig.json @@ -7,7 +7,6 @@ "strict": true, "skipLibCheck": true, "isolatedModules": true, - "verbatimModuleSyntax": true, "declaration": true, "sourceMap": true, "declarationMap": true, diff --git a/packages/http-server-csharp/tsconfig.json b/packages/http-server-csharp/tsconfig.json index f827b7a0ef8..ec80b5e2552 100644 --- a/packages/http-server-csharp/tsconfig.json +++ b/packages/http-server-csharp/tsconfig.json @@ -12,7 +12,6 @@ "target": "es2022", "skipLibCheck": true, "isolatedModules": true, - "verbatimModuleSyntax": true, "jsx": "preserve", "jsxImportSource": "@alloy-js/core", "emitDeclarationOnly": true, diff --git a/packages/http-server-js/tsconfig.json b/packages/http-server-js/tsconfig.json index d42bedb6fb1..663788e7095 100644 --- a/packages/http-server-js/tsconfig.json +++ b/packages/http-server-js/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.build.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/http-specs/tsconfig.json b/packages/http-specs/tsconfig.json index 8be62396186..8d289778205 100644 --- a/packages/http-specs/tsconfig.json +++ b/packages/http-specs/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/.tsbuildinfo", diff --git a/packages/http/tsconfig.json b/packages/http/tsconfig.json index 8543051589c..3dc7c231583 100644 --- a/packages/http/tsconfig.json +++ b/packages/http/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "verbatimModuleSyntax": true, "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/internal-build-utils/tsconfig.json b/packages/internal-build-utils/tsconfig.json index c518e28e5bf..84433f97361 100644 --- a/packages/internal-build-utils/tsconfig.json +++ b/packages/internal-build-utils/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/json-schema/tsconfig.json b/packages/json-schema/tsconfig.json index 8d0eb2d00d4..3dc7c231583 100644 --- a/packages/json-schema/tsconfig.json +++ b/packages/json-schema/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", - "verbatimModuleSyntax": true + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/library-linter/tsconfig.json b/packages/library-linter/tsconfig.json index 67579bc0ca2..0d7c12c5ddf 100644 --- a/packages/library-linter/tsconfig.json +++ b/packages/library-linter/tsconfig.json @@ -6,7 +6,6 @@ { "path": "../openapi/tsconfig.json" } ], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/monarch/tsconfig.json b/packages/monarch/tsconfig.json index 20558622369..84433f97361 100644 --- a/packages/monarch/tsconfig.json +++ b/packages/monarch/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", - "verbatimModuleSyntax": true + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/mutator-framework/tsconfig.json b/packages/mutator-framework/tsconfig.json index 2041003b42b..407883a9cee 100644 --- a/packages/mutator-framework/tsconfig.json +++ b/packages/mutator-framework/tsconfig.json @@ -11,8 +11,7 @@ "sourceMap": true, "declarationMap": true, "outDir": "dist", - "rootDir": "./", - "verbatimModuleSyntax": true + "rootDir": "./" }, "exclude": ["node_modules", "dist"] } diff --git a/packages/openapi/tsconfig.json b/packages/openapi/tsconfig.json index 8fb7f12d404..a641027b2e0 100644 --- a/packages/openapi/tsconfig.json +++ b/packages/openapi/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }, { "path": "../rest/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/openapi3/tsconfig.json b/packages/openapi3/tsconfig.json index 362551d42f6..95a22b226e4 100644 --- a/packages/openapi3/tsconfig.json +++ b/packages/openapi3/tsconfig.json @@ -8,7 +8,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "verbatimModuleSyntax": true, "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/pack/tsconfig.json b/packages/pack/tsconfig.json index cf665cfca6a..4b653c33a25 100644 --- a/packages/pack/tsconfig.json +++ b/packages/pack/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": "src", - "verbatimModuleSyntax": true, "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" }, "include": ["src"] diff --git a/packages/playground-website/tsconfig.json b/packages/playground-website/tsconfig.json index b278dff64fb..8fbcdf1aae4 100644 --- a/packages/playground-website/tsconfig.json +++ b/packages/playground-website/tsconfig.json @@ -15,7 +15,6 @@ "jsx": "react-jsx", "checkJs": true, "allowJs": true, - "verbatimModuleSyntax": true, "lib": ["DOM", "ES2022"], "types": ["vite/client"] }, diff --git a/packages/playground/tsconfig.json b/packages/playground/tsconfig.json index ed9f207dfa5..569ddf6d0c1 100644 --- a/packages/playground/tsconfig.json +++ b/packages/playground/tsconfig.json @@ -10,7 +10,6 @@ "outDir": "dist", "rootDir": ".", "skipLibCheck": true, - "verbatimModuleSyntax": true, "jsx": "react-jsx", "lib": ["DOM"] }, diff --git a/packages/protobuf/tsconfig.json b/packages/protobuf/tsconfig.json index 17a050101ce..3dc7c231583 100644 --- a/packages/protobuf/tsconfig.json +++ b/packages/protobuf/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/react-components/tsconfig.json b/packages/react-components/tsconfig.json index 56753bd8547..634fa4c4d2d 100644 --- a/packages/react-components/tsconfig.json +++ b/packages/react-components/tsconfig.json @@ -10,7 +10,6 @@ "resolveJsonModule": true, "noEmit": true, "skipLibCheck": true, - "verbatimModuleSyntax": true, "jsx": "react-jsx", "lib": ["DOM", "ES2022"], "types": ["vite/client", "@testing-library/jest-dom"] diff --git a/packages/rest/tsconfig.json b/packages/rest/tsconfig.json index 504e72302f6..e6bf4da603f 100644 --- a/packages/rest/tsconfig.json +++ b/packages/rest/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }, { "path": "../http/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/samples/tsconfig.json b/packages/samples/tsconfig.json index 8fb7f12d404..a641027b2e0 100644 --- a/packages/samples/tsconfig.json +++ b/packages/samples/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }, { "path": "../rest/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/spec-api/tsconfig.json b/packages/spec-api/tsconfig.json index 7a9e9cfec7c..3212792bdc8 100644 --- a/packages/spec-api/tsconfig.json +++ b/packages/spec-api/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "verbatimModuleSyntax": true, "rootDir": ".", "outDir": "dist", "tsBuildInfoFile": "temp/.tsbuildinfo", diff --git a/packages/spec-coverage-sdk/tsconfig.json b/packages/spec-coverage-sdk/tsconfig.json index 2762a3149ea..0cf29100761 100644 --- a/packages/spec-coverage-sdk/tsconfig.json +++ b/packages/spec-coverage-sdk/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "tsBuildInfoFile": "temp/.tsbuildinfo" }, diff --git a/packages/spec-dashboard/tsconfig.json b/packages/spec-dashboard/tsconfig.json index 6120f5c5917..d3022633ff7 100644 --- a/packages/spec-dashboard/tsconfig.json +++ b/packages/spec-dashboard/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "verbatimModuleSyntax": true, "rootDir": "src", "incremental": false, "composite": false, diff --git a/packages/spector/tsconfig.json b/packages/spector/tsconfig.json index 1d6964f629d..79fb341f399 100644 --- a/packages/spector/tsconfig.json +++ b/packages/spector/tsconfig.json @@ -1,6 +1,4 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "verbatimModuleSyntax": true - } + "compilerOptions": {} } diff --git a/packages/sse/tsconfig.json b/packages/sse/tsconfig.json index 8d0eb2d00d4..3dc7c231583 100644 --- a/packages/sse/tsconfig.json +++ b/packages/sse/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", - "verbatimModuleSyntax": true + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/standalone/tsconfig.json b/packages/standalone/tsconfig.json index 31bdac401f2..326b853e0a1 100644 --- a/packages/standalone/tsconfig.json +++ b/packages/standalone/tsconfig.json @@ -6,7 +6,6 @@ "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", "allowImportingTsExtensions": true, - "noEmit": true, - "verbatimModuleSyntax": true + "noEmit": true } } diff --git a/packages/streams/tsconfig.json b/packages/streams/tsconfig.json index 17a050101ce..3dc7c231583 100644 --- a/packages/streams/tsconfig.json +++ b/packages/streams/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/tmlanguage-generator/tsconfig.json b/packages/tmlanguage-generator/tsconfig.json index a1040360f3e..640eb95f6ca 100644 --- a/packages/tmlanguage-generator/tsconfig.json +++ b/packages/tmlanguage-generator/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": "src", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" diff --git a/packages/tsp-integration/tsconfig.json b/packages/tsp-integration/tsconfig.json index ab48d103617..24820dc0991 100644 --- a/packages/tsp-integration/tsconfig.json +++ b/packages/tsp-integration/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "declaration": true, - "verbatimModuleSyntax": true, "rootDir": "src", "outDir": "dist" }, diff --git a/packages/tspd/tsconfig.json b/packages/tspd/tsconfig.json index 20acddf4861..e3175ca3943 100644 --- a/packages/tspd/tsconfig.json +++ b/packages/tspd/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../compiler/tsconfig.json" }, { "path": "../rest/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "outDir": "dist", "rootDir": ".", "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", diff --git a/packages/typespec-vscode/tsconfig.json b/packages/typespec-vscode/tsconfig.json index ee69721dbfb..f8068cf9928 100644 --- a/packages/typespec-vscode/tsconfig.json +++ b/packages/typespec-vscode/tsconfig.json @@ -2,7 +2,6 @@ "extends": "../../tsconfig.base.json", "references": [{ "path": "../tmlanguage-generator/tsconfig.json" }], "compilerOptions": { - "verbatimModuleSyntax": true, "incremental": false, "composite": false, "module": "preserve", diff --git a/packages/versioning/tsconfig.json b/packages/versioning/tsconfig.json index f7e9c775c74..a641027b2e0 100644 --- a/packages/versioning/tsconfig.json +++ b/packages/versioning/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "verbatimModuleSyntax": true, "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/packages/xml/tsconfig.json b/packages/xml/tsconfig.json index 8d0eb2d00d4..3dc7c231583 100644 --- a/packages/xml/tsconfig.json +++ b/packages/xml/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "outDir": "dist", "rootDir": ".", - "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", - "verbatimModuleSyntax": true + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" } } diff --git a/tsconfig.base.json b/tsconfig.base.json index c904fcfe8f8..b9211e1fca0 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,6 +1,7 @@ { "compilerOptions": { "composite": true, + "verbatimModuleSyntax": true, "alwaysStrict": true, "forceConsistentCasingInFileNames": true, "module": "NodeNext",