Skip to content

Commit cbb0f76

Browse files
authored
feat: enable verbatimModuleSyntax in TypeScript config (#5533)
## Summary - Enable `verbatimModuleSyntax` compiler option in TypeScript configuration - Update all type imports to use explicit `import type` syntax - This change will Improve tree-shaking and bundler compatibility ## Motivation The `verbatimModuleSyntax` option ensures that type-only imports are explicitly marked with the `type` keyword. This: - Makes import/export intentions clearer - Improves tree-shaking by helping bundlers identify what can be safely removed - Ensures better compatibility with modern bundlers - Follows TypeScript best practices for module syntax ## Changes - Added `"verbatimModuleSyntax": true` to `tsconfig.json` - Updated another 48+ files to use explicit `import type` syntax for type-only imports - No functional changes, only import/export syntax improvements ## Test Plan - [x] TypeScript compilation passes - [x] Build completes successfully - [x] Tests pass - [ ] No runtime behavior changes 🤖 Generated with [Claude Code](https://claude.ai/code) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5533-feat-enable-verbatimModuleSyntax-in-TypeScript-config-26d6d73d36508190b424ef9b379b5130) by [Unito](https://www.unito.io)
1 parent 726a2fb commit cbb0f76

37 files changed

+96
-80
lines changed

build/plugins/comfyAPIPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from 'path'
2-
import { Plugin } from 'vite'
2+
import type { Plugin } from 'vite'
33

44
interface ShimResult {
55
code: string

build/plugins/generateImportMapPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import glob from 'fast-glob'
22
import fs from 'fs-extra'
33
import { dirname, join } from 'node:path'
4-
import { HtmlTagDescriptor, Plugin, normalizePath } from 'vite'
4+
import { type HtmlTagDescriptor, type Plugin, normalizePath } from 'vite'
55

66
interface ImportMapSource {
77
name: string

src/extensions/core/groupNode.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import {
1111
} from '@/lib/litegraph/src/litegraph'
1212
import { useToastStore } from '@/platform/updates/common/toastStore'
1313
import {
14-
ComfyLink,
15-
ComfyNode,
16-
ComfyWorkflowJSON
14+
type ComfyLink,
15+
type ComfyNode,
16+
type ComfyWorkflowJSON
1717
} from '@/platform/workflow/validation/schemas/workflowSchema'
1818
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
1919
import { useDialogService } from '@/services/dialogService'
2020
import { useExecutionStore } from '@/stores/executionStore'
2121
import { useNodeDefStore } from '@/stores/nodeDefStore'
2222
import { useWidgetStore } from '@/stores/widgetStore'
23-
import { ComfyExtension } from '@/types/comfy'
23+
import { type ComfyExtension } from '@/types/comfy'
2424
import { ExecutableGroupNodeChildDTO } from '@/utils/executableGroupNodeChildDTO'
2525
import { GROUP } from '@/utils/executableGroupNodeDto'
2626
import { deserialiseAndCreate, serialise } from '@/utils/vintageClipboard'

src/extensions/core/load3d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Load3dUtils from '@/extensions/core/load3d/Load3dUtils'
99
import { t } from '@/i18n'
1010
import type { IStringWidget } from '@/lib/litegraph/src/types/widgets'
1111
import { useToastStore } from '@/platform/updates/common/toastStore'
12-
import { CustomInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
12+
import { type CustomInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
1313
import { api } from '@/scripts/api'
1414
import { ComfyApp, app } from '@/scripts/app'
1515
import { ComponentWidgetImpl, addWidget } from '@/scripts/domWidget'

src/extensions/core/load3d/AnimationManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as THREE from 'three'
22

33
import {
4-
AnimationItem,
5-
AnimationManagerInterface,
6-
EventManagerInterface
4+
type AnimationItem,
5+
type AnimationManagerInterface,
6+
type EventManagerInterface
77
} from '@/extensions/core/load3d/interfaces'
88

99
export class AnimationManager implements AnimationManagerInterface {

src/extensions/core/load3d/CameraManager.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import * as THREE from 'three'
22
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
33

44
import {
5-
CameraManagerInterface,
6-
CameraState,
7-
CameraType,
8-
EventManagerInterface,
9-
NodeStorageInterface
5+
type CameraManagerInterface,
6+
type CameraState,
7+
type CameraType,
8+
type EventManagerInterface,
9+
type NodeStorageInterface
1010
} from './interfaces'
1111

1212
export class CameraManager implements CameraManagerInterface {

src/extensions/core/load3d/ControlsManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import * as THREE from 'three'
22
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
33

44
import {
5-
ControlsManagerInterface,
6-
EventManagerInterface,
7-
NodeStorageInterface
5+
type ControlsManagerInterface,
6+
type EventManagerInterface,
7+
type NodeStorageInterface
88
} from './interfaces'
99

1010
export class ControlsManager implements ControlsManagerInterface {

src/extensions/core/load3d/EventManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EventCallback, EventManagerInterface } from './interfaces'
1+
import { type EventCallback, type EventManagerInterface } from './interfaces'
22

33
export class EventManager implements EventManagerInterface {
44
private listeners: { [key: string]: EventCallback[] } = {}

src/extensions/core/load3d/LightingManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as THREE from 'three'
22

3-
import { EventManagerInterface, LightingManagerInterface } from './interfaces'
3+
import {
4+
type EventManagerInterface,
5+
type LightingManagerInterface
6+
} from './interfaces'
47

58
export class LightingManager implements LightingManagerInterface {
69
lights: THREE.Light[] = []

src/extensions/core/load3d/Load3d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as THREE from 'three'
22

33
import { LGraphNode } from '@/lib/litegraph/src/litegraph'
4-
import { CustomInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
4+
import { type CustomInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
55

66
import { CameraManager } from './CameraManager'
77
import { ControlsManager } from './ControlsManager'
@@ -16,11 +16,11 @@ import { SceneManager } from './SceneManager'
1616
import { SceneModelManager } from './SceneModelManager'
1717
import { ViewHelperManager } from './ViewHelperManager'
1818
import {
19-
CameraState,
20-
CaptureResult,
21-
Load3DOptions,
22-
MaterialMode,
23-
UpDirection
19+
type CameraState,
20+
type CaptureResult,
21+
type Load3DOptions,
22+
type MaterialMode,
23+
type UpDirection
2424
} from './interfaces'
2525

2626
class Load3d {

0 commit comments

Comments
 (0)