diff --git a/stage_3_generation/build/decorators/createDecorators.ts b/stage_3_generation/build/decorators/createDecorators.ts index e6d8cb0..f7d6843 100644 --- a/stage_3_generation/build/decorators/createDecorators.ts +++ b/stage_3_generation/build/decorators/createDecorators.ts @@ -1,10 +1,12 @@ import assert from "node:assert/strict"; import { - StructureKind + Scope, + StructureKind, } from "ts-morph"; import { + type ClassMemberImpl, LiteralTypeStructureImpl, MemberedTypeToClass, type TypeMembersMap, @@ -81,6 +83,24 @@ async function buildDecorator( } typeToClass.defineStatementsByPurpose("body", false); + + typeToClass.scopeCallback = { + getScope: function( + isStatic: boolean, + kind: ClassMemberImpl["kind"], + memberName: string + ): Scope | undefined + { + void(isStatic); + void(kind); + if (memberName === "[COPY_FIELDS]") + return Scope.Public; + if (memberName === "toJSON") + return Scope.Public; + return undefined; + } + }; + module.classMembersMap = typeToClass.buildClassMembersMap(); // eslint complains when we say isAsync: boolean = false; diff --git a/stage_3_snapshot/spec-snapshot/fileHashes.ts b/stage_3_snapshot/spec-snapshot/fileHashes.ts index c710b81..fb9d1cf 100644 --- a/stage_3_snapshot/spec-snapshot/fileHashes.ts +++ b/stage_3_snapshot/spec-snapshot/fileHashes.ts @@ -44,6 +44,10 @@ describe("File hashes match for the", () => { await compareSnapshots("source/bootstrap"); }); + xit("decorators", async () => { + await compareSnapshots("source/decorators/standard"); + }); + it("interfaces", async () => { await compareSnapshots("source/interfaces"); });