Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ export namespace NestiaMigrateApiStartProgrammer {
const route: IHttpMigrateRoute | undefined = pick(
context.application.routes,
);
const main: ts.VariableStatement = writeMain(
context,
importer,
route,
);
const main: ts.VariableStatement = writeMain(context, importer, route);
const statements: ts.Statement[] = [
...importer.toStatements(
(name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`,
Expand All @@ -34,7 +30,7 @@ export namespace NestiaMigrateApiStartProgrammer {
factory.createImportDeclaration(
undefined,
factory.createImportClause(
false,
undefined,
undefined,
factory.createNamedImports([
factory.createImportSpecifier(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { factory } from "@ttsc/factory";
import { SyntaxKind, factory } from "@ttsc/factory";

import { TypeLiteralFactory } from "../factories/TypeLiteralFactory";
import ts from "../internal/ts";
Expand Down Expand Up @@ -67,7 +67,7 @@ export class NestiaMigrateImportProgrammer {
factory.createImportDeclaration(
undefined,
factory.createImportClause(
false,
undefined,
props.default !== null
? factory.createIdentifier(props.default)
: undefined,
Expand Down Expand Up @@ -96,7 +96,7 @@ export class NestiaMigrateImportProgrammer {
// only in type positions — keep the clause type-only so emitted
// JS never loads the DTO module at runtime.
factory.createImportClause(
true,
SyntaxKind.TypeKeyword,
undefined,
factory.createNamedImports(
names.map((name) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const $import = (file: string) => (instance: string) =>
factory.createImportDeclaration(
undefined,
factory.createImportClause(
false,
undefined,
undefined,
factory.createNamedImports([
factory.createImportSpecifier(
Expand Down
11 changes: 8 additions & 3 deletions packages/sdk/src/generates/internal/ImportDictionary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { type ImportClause, type Node, factory } from "@ttsc/factory";
import {
type ImportClause,
type Node,
SyntaxKind,
factory,
} from "@ttsc/factory";
import path from "path";
import { HashMap, TreeMap, hash } from "tstl";

Expand Down Expand Up @@ -136,14 +141,14 @@ export class ImportDictionary {
// generated SDK code references DTO namespaces only in type positions.
if (c.asterisk !== null)
return factory.createImportClause(
c.declaration,
c.declaration ? SyntaxKind.TypeKeyword : undefined,
undefined,
factory.createNamespaceImport(factory.createIdentifier(c.asterisk)),
);
// `c.declaration` (type-only) belongs on the import clause, not on each
// specifier — emitting both produces the invalid `import type { type X }`.
return factory.createImportClause(
c.declaration,
c.declaration ? SyntaxKind.TypeKeyword : undefined,
c.default !== null ? factory.createIdentifier(c.default) : undefined,
c.elements.size() !== 0
? factory.createNamedImports(
Expand Down
Loading
Loading