counterfact
Version:
Generate a TypeScript-based mock server from an OpenAPI spec in seconds — with stateful routes, hot reload, and REPL support.
28 lines (27 loc) • 765 B
JavaScript
import { TypeCoder } from "./type-coder.js";
export class ParameterExportTypeCoder extends TypeCoder {
_typeName;
_typeCode;
_parameterKind;
_modulePath;
constructor(requirement, version, typeName, typeCode, parameterKind) {
super(requirement, version);
this._typeName = typeName;
this._typeCode = typeCode;
this._parameterKind = parameterKind;
}
get id() {
// Make the id unique by including the parameter kind
return `${super.id}:${this._parameterKind}`;
}
*names() {
yield this._typeName;
}
writeCode() {
return this._typeCode;
}
modulePath() {
// Use the same module path as the parent operation
return this._modulePath;
}
}