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.
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import type { IFunctionCallArgument } from './IFunctionCallArgument';
|
|
import type { IFunctionCallArgumentCollection } from './IFunctionCallArgumentCollection';
|
|
|
|
export class FunctionCallArgumentCollection implements IFunctionCallArgumentCollection {
|
|
private readonly arguments = new Map<string, IFunctionCallArgument>();
|
|
|
|
public addArgument(argument: IFunctionCallArgument): void {
|
|
if (this.hasArgument(argument.parameterName)) {
|
|
throw new Error(`argument value for parameter ${argument.parameterName} is already provided`);
|
|
}
|
|
this.arguments.set(argument.parameterName, argument);
|
|
}
|
|
|
|
public getAllParameterNames(): string[] {
|
|
return Array.from(this.arguments.keys());
|
|
}
|
|
|
|
public hasArgument(parameterName: string): boolean {
|
|
if (!parameterName) {
|
|
throw new Error('missing parameter name');
|
|
}
|
|
return this.arguments.has(parameterName);
|
|
}
|
|
|
|
public getArgument(parameterName: string): IFunctionCallArgument {
|
|
if (!parameterName) {
|
|
throw new Error('missing parameter name');
|
|
}
|
|
const arg = this.arguments.get(parameterName);
|
|
if (!arg) {
|
|
throw new Error(`parameter does not exist: ${parameterName}`);
|
|
}
|
|
return arg;
|
|
}
|
|
}
|