This commit upgrades TypeScript to the latest version 5.3 and introduces `verbatimModuleSyntax` in line with the official Vue guide recommendatinos (vuejs/docs#2592). By enforcing `import type` for type-only imports, this commit improves code clarity and supports tooling optimization, ensuring imports are only bundled when necessary for runtime. Changes: - Bump TypeScript to 5.3.3 across the project. - Adjust import statements to utilize `import type` where applicable, promoting cleaner and more efficient code.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import type { TreeInputNodeData } from '@/presentation/components/Scripts/View/Tree/TreeView/Bindings/TreeInputNodeData';
|
|
import type { TreeNode } from '@/presentation/components/Scripts/View/Tree/TreeView/Node/TreeNode';
|
|
import { parseTreeInput } from '@/presentation/components/Scripts/View/Tree/TreeView/TreeRoot/NodeCollection/TreeInputParser';
|
|
import { TreeNodeStub } from './TreeNodeStub';
|
|
|
|
interface StubScenario {
|
|
readonly given: readonly TreeInputNodeData[],
|
|
readonly result: TreeNode[],
|
|
}
|
|
|
|
export function createTreeNodeParserStub() {
|
|
const scenarios = new Array<StubScenario>();
|
|
function registerScenario(scenario: StubScenario) {
|
|
scenarios.push(scenario);
|
|
}
|
|
const parseTreeInputStub: typeof parseTreeInput = (
|
|
data: readonly TreeInputNodeData[],
|
|
): TreeNode[] => {
|
|
const result = scenarios.find((scenario) => scenario.given === data);
|
|
if (result !== undefined) {
|
|
return result.result;
|
|
}
|
|
return data.map(() => new TreeNodeStub()
|
|
.withId(`[${createTreeNodeParserStub.name}] parsed-node-stub`));
|
|
};
|
|
return {
|
|
registerScenario,
|
|
parseTreeInputStub,
|
|
};
|
|
}
|