diff --git a/.changeset/breezy-ladybugs-smash.md b/.changeset/breezy-ladybugs-smash.md new file mode 100644 index 000000000..f1f0abbb8 --- /dev/null +++ b/.changeset/breezy-ladybugs-smash.md @@ -0,0 +1,5 @@ +--- +'@metaplex-foundation/kinobi': patch +--- + +Remove TS unique symbols for nodes diff --git a/src/nodes/AccountDataNode.ts b/src/nodes/AccountDataNode.ts index 66e7d779f..57f07edec 100644 --- a/src/nodes/AccountDataNode.ts +++ b/src/nodes/AccountDataNode.ts @@ -4,18 +4,16 @@ import type { Node } from './Node'; import { StructTypeNode } from './typeNodes/StructTypeNode'; export type AccountDataNode = { - readonly __accountDataNode: unique symbol; readonly kind: 'accountDataNode'; readonly name: MainCaseString; readonly struct: StructTypeNode; readonly link?: LinkTypeNode; }; -export type AccountDataNodeInput = Omit< - AccountDataNode, - '__accountDataNode' | 'kind' | 'name' -> & { - name: string; +export type AccountDataNodeInput = { + readonly name: string; + readonly struct: StructTypeNode; + readonly link?: LinkTypeNode; }; export function accountDataNode(input: AccountDataNodeInput): AccountDataNode { @@ -27,7 +25,7 @@ export function accountDataNode(input: AccountDataNodeInput): AccountDataNode { name: mainCase(input.name), struct: input.struct, link: input.link, - } as AccountDataNode; + }; } export function isAccountDataNode(node: Node | null): node is AccountDataNode { diff --git a/src/nodes/AccountNode.ts b/src/nodes/AccountNode.ts index 602f62282..6e2f29657 100644 --- a/src/nodes/AccountNode.ts +++ b/src/nodes/AccountNode.ts @@ -17,7 +17,6 @@ import { TypeNode, createTypeNodeFromIdl } from './typeNodes/TypeNode'; import { vScalar } from './ValueNode'; export type AccountNode = { - readonly __accountNode: unique symbol; readonly kind: 'accountNode'; readonly name: MainCaseString; readonly data: AccountDataNode; @@ -31,9 +30,9 @@ export type AccountNode = { export type AccountNodeInput = Omit< PartialExcept, - '__accountNode' | 'kind' | 'name' + 'kind' | 'name' > & { - name: string; + readonly name: string; }; export function accountNode(input: AccountNodeInput): AccountNode { @@ -50,7 +49,7 @@ export function accountNode(input: AccountNodeInput): AccountNode { size: input.size, seeds: input.seeds ?? [], discriminator: input.discriminator, - } as AccountNode; + }; } export function accountNodeFromIdl(idl: Partial): AccountNode { diff --git a/src/nodes/DefinedTypeNode.ts b/src/nodes/DefinedTypeNode.ts index 2af031b42..85e9377e4 100644 --- a/src/nodes/DefinedTypeNode.ts +++ b/src/nodes/DefinedTypeNode.ts @@ -4,7 +4,6 @@ import type { Node } from './Node'; import { TypeNode, createTypeNodeFromIdl } from './typeNodes/TypeNode'; export type DefinedTypeNode = { - readonly __definedTypeNode: unique symbol; readonly kind: 'definedTypeNode'; readonly name: MainCaseString; readonly data: TypeNode; @@ -32,7 +31,7 @@ export function definedTypeNode(input: DefinedTypeNodeInput): DefinedTypeNode { idlName: input.idlName ?? input.name, docs: input.docs ?? [], internal: input.internal ?? false, - } as DefinedTypeNode; + }; } export function definedTypeNodeFromIdl( diff --git a/src/nodes/ErrorNode.ts b/src/nodes/ErrorNode.ts index 149b6df01..bc3521125 100644 --- a/src/nodes/ErrorNode.ts +++ b/src/nodes/ErrorNode.ts @@ -8,7 +8,6 @@ import { import type { Node } from './Node'; export type ErrorNode = { - readonly __errorNode: unique symbol; readonly kind: 'errorNode'; readonly name: MainCaseString; readonly idlName: string; @@ -19,9 +18,9 @@ export type ErrorNode = { export type ErrorNodeInput = Omit< PartialExcept, - '__errorNode' | 'kind' | 'name' + 'kind' | 'name' > & { - name: string; + readonly name: string; }; export function errorNode(input: ErrorNodeInput): ErrorNode { @@ -38,7 +37,7 @@ export function errorNode(input: ErrorNodeInput): ErrorNode { code: input.code, message: input.message, docs: input.docs ?? [], - } as ErrorNode; + }; } export function errorNodeFromIdl(idl: Partial): ErrorNode { diff --git a/src/nodes/InstructionAccountNode.ts b/src/nodes/InstructionAccountNode.ts index d05d46520..3b7495d3e 100644 --- a/src/nodes/InstructionAccountNode.ts +++ b/src/nodes/InstructionAccountNode.ts @@ -8,7 +8,6 @@ import { import type { Node } from './Node'; export type InstructionAccountNode = { - readonly __instructionAccountNode: unique symbol; readonly kind: 'instructionAccountNode'; readonly name: MainCaseString; readonly isWritable: boolean; @@ -20,9 +19,9 @@ export type InstructionAccountNode = { export type InstructionAccountNodeInput = Omit< PartialExcept, - '__instructionAccountNode' | 'kind' | 'name' + 'kind' | 'name' > & { - name: string; + readonly name: string; }; export function instructionAccountNode( @@ -36,7 +35,7 @@ export function instructionAccountNode( isOptional: input.isOptional ?? false, docs: input.docs ?? [], defaultsTo: input.defaultsTo, - } as InstructionAccountNode; + }; } export function instructionAccountNodeFromIdl( diff --git a/src/nodes/InstructionDataArgsNode.ts b/src/nodes/InstructionDataArgsNode.ts index 4efa7b3ee..fbb61726d 100644 --- a/src/nodes/InstructionDataArgsNode.ts +++ b/src/nodes/InstructionDataArgsNode.ts @@ -4,7 +4,6 @@ import type { Node } from './Node'; import { StructTypeNode } from './typeNodes/StructTypeNode'; export type InstructionDataArgsNode = { - readonly __instructionDataArgsNode: unique symbol; readonly kind: 'instructionDataArgsNode'; readonly name: MainCaseString; readonly struct: StructTypeNode; @@ -13,9 +12,9 @@ export type InstructionDataArgsNode = { export type InstructionDataArgsNodeInput = Omit< InstructionDataArgsNode, - '__instructionDataArgsNode' | 'kind' | 'name' + 'kind' | 'name' > & { - name: string; + readonly name: string; }; export function instructionDataArgsNode( @@ -31,7 +30,7 @@ export function instructionDataArgsNode( name: mainCase(input.name), struct: input.struct, link: input.link, - } as InstructionDataArgsNode; + }; } export function isInstructionDataArgsNode( diff --git a/src/nodes/InstructionExtraArgsNode.ts b/src/nodes/InstructionExtraArgsNode.ts index ad0d23a55..cab799b24 100644 --- a/src/nodes/InstructionExtraArgsNode.ts +++ b/src/nodes/InstructionExtraArgsNode.ts @@ -4,7 +4,6 @@ import type { Node } from './Node'; import { StructTypeNode } from './typeNodes/StructTypeNode'; export type InstructionExtraArgsNode = { - readonly __instructionExtraArgsNode: unique symbol; readonly kind: 'instructionExtraArgsNode'; readonly name: MainCaseString; readonly struct: StructTypeNode; @@ -13,9 +12,9 @@ export type InstructionExtraArgsNode = { export type InstructionExtraArgsNodeInput = Omit< InstructionExtraArgsNode, - '__instructionExtraArgsNode' | 'kind' | 'name' + 'kind' | 'name' > & { - name: string; + readonly name: string; }; export function instructionExtraArgsNode( @@ -31,7 +30,7 @@ export function instructionExtraArgsNode( name: mainCase(input.name), struct: input.struct, link: input.link, - } as InstructionExtraArgsNode; + }; } export function isInstructionExtraArgsNode( diff --git a/src/nodes/InstructionNode.ts b/src/nodes/InstructionNode.ts index 923857709..db34e65cd 100644 --- a/src/nodes/InstructionNode.ts +++ b/src/nodes/InstructionNode.ts @@ -32,7 +32,6 @@ import { createTypeNodeFromIdl } from './typeNodes/TypeNode'; import { vScalar } from './ValueNode'; export type InstructionNode = { - readonly __instructionNode: unique symbol; readonly kind: 'instructionNode'; readonly name: MainCaseString; readonly accounts: InstructionAccountNode[]; @@ -50,10 +49,10 @@ export type InstructionNode = { export type InstructionNodeInput = Omit< PartialExcept, - '__instructionNode' | 'kind' | 'name' | 'argDefaults' + 'kind' | 'name' | 'argDefaults' > & { - name: string; - argDefaults?: Record; + readonly name: string; + readonly argDefaults?: Record; }; export function instructionNode(input: InstructionNodeInput): InstructionNode { @@ -85,7 +84,7 @@ export function instructionNode(input: InstructionNodeInput): InstructionNode { ]) ), optionalAccountStrategy: input.optionalAccountStrategy ?? 'programId', - } as InstructionNode; + }; } export function instructionNodeFromIdl( diff --git a/src/nodes/ProgramNode.ts b/src/nodes/ProgramNode.ts index 7ec4c2fe0..2a91f129c 100644 --- a/src/nodes/ProgramNode.ts +++ b/src/nodes/ProgramNode.ts @@ -7,7 +7,6 @@ import { InstructionNode, instructionNodeFromIdl } from './InstructionNode'; import type { Node } from './Node'; export type ProgramNode = { - readonly __programNode: unique symbol; readonly kind: 'programNode'; readonly accounts: AccountNode[]; readonly instructions: InstructionNode[]; @@ -31,10 +30,10 @@ export type ProgramNodeInput = Omit< | 'publicKey' | 'version' >, - '__programNode' | 'kind' | 'name' | 'prefix' + 'kind' | 'name' | 'prefix' > & { - name: string; - prefix?: string; + readonly name: string; + readonly prefix?: string; }; export function programNode(input: ProgramNodeInput): ProgramNode { @@ -50,7 +49,7 @@ export function programNode(input: ProgramNodeInput): ProgramNode { version: input.version, origin: input.origin, internal: input.internal ?? false, - } as ProgramNode; + }; } export function programNodeFromIdl(idl: Partial): ProgramNode { diff --git a/src/nodes/RootNode.ts b/src/nodes/RootNode.ts index de8942af3..024935f73 100644 --- a/src/nodes/RootNode.ts +++ b/src/nodes/RootNode.ts @@ -10,13 +10,12 @@ import { ProgramNode, programNodeFromIdl } from './ProgramNode'; export type IdlInputs = string | Partial | (string | Partial)[]; export type RootNode = { - readonly __rootNode: unique symbol; readonly kind: 'rootNode'; readonly programs: ProgramNode[]; }; export function rootNode(programs: ProgramNode[]): RootNode { - return { kind: 'rootNode', programs } as RootNode; + return { kind: 'rootNode', programs }; } export function rootNodeFromIdls(idls: IdlInputs): RootNode { diff --git a/src/nodes/typeNodes/ArrayTypeNode.ts b/src/nodes/typeNodes/ArrayTypeNode.ts index b7e96a096..8f4bc8985 100644 --- a/src/nodes/typeNodes/ArrayTypeNode.ts +++ b/src/nodes/typeNodes/ArrayTypeNode.ts @@ -10,7 +10,6 @@ import { numberTypeNode } from './NumberTypeNode'; import { TypeNode, createTypeNodeFromIdl } from './TypeNode'; export type ArrayTypeNode = { - readonly __arrayTypeNode: unique symbol; readonly kind: 'arrayTypeNode'; readonly child: TypeNode; readonly size: SizeStrategy; @@ -22,11 +21,7 @@ export function arrayTypeNode( readonly size?: ArrayTypeNode['size']; } = {} ): ArrayTypeNode { - return { - kind: 'arrayTypeNode', - child, - size: options.size ?? prefixedSize(), - } as ArrayTypeNode; + return { kind: 'arrayTypeNode', child, size: options.size ?? prefixedSize() }; } export function arrayTypeNodeFromIdl( diff --git a/src/nodes/typeNodes/BoolTypeNode.ts b/src/nodes/typeNodes/BoolTypeNode.ts index 7a0c41068..247589a22 100644 --- a/src/nodes/typeNodes/BoolTypeNode.ts +++ b/src/nodes/typeNodes/BoolTypeNode.ts @@ -6,16 +6,12 @@ import { } from './NumberTypeNode'; export type BoolTypeNode = { - readonly __boolTypeNode: unique symbol; readonly kind: 'boolTypeNode'; readonly size: NumberTypeNode; }; export function boolTypeNode(size?: NumberTypeNode): BoolTypeNode { - return { - kind: 'boolTypeNode', - size: size ?? numberTypeNode('u8'), - } as BoolTypeNode; + return { kind: 'boolTypeNode', size: size ?? numberTypeNode('u8') }; } export function displayBoolTypeNode(node: BoolTypeNode): string { diff --git a/src/nodes/typeNodes/BytesTypeNode.ts b/src/nodes/typeNodes/BytesTypeNode.ts index e3e02b4bf..7ce116b08 100644 --- a/src/nodes/typeNodes/BytesTypeNode.ts +++ b/src/nodes/typeNodes/BytesTypeNode.ts @@ -6,16 +6,12 @@ import { import type { Node } from '../Node'; export type BytesTypeNode = { - readonly __bytesTypeNode: unique symbol; readonly kind: 'bytesTypeNode'; readonly size: SizeStrategy; }; export function bytesTypeNode(size?: SizeStrategy): BytesTypeNode { - return { - kind: 'bytesTypeNode', - size: size ?? remainderSize(), - } as BytesTypeNode; + return { kind: 'bytesTypeNode', size: size ?? remainderSize() }; } export function displayBytesTypeNode(node: BytesTypeNode): string { diff --git a/src/nodes/typeNodes/EnumEmptyVariantTypeNode.ts b/src/nodes/typeNodes/EnumEmptyVariantTypeNode.ts index 9c35d982d..3d31d3160 100644 --- a/src/nodes/typeNodes/EnumEmptyVariantTypeNode.ts +++ b/src/nodes/typeNodes/EnumEmptyVariantTypeNode.ts @@ -3,7 +3,6 @@ import { InvalidKinobiTreeError, MainCaseString, mainCase } from '../../shared'; import type { Node } from '../Node'; export type EnumEmptyVariantTypeNode = { - readonly __enumEmptyVariantTypeNode: unique symbol; readonly kind: 'enumEmptyVariantTypeNode'; readonly name: MainCaseString; }; @@ -16,10 +15,7 @@ export function enumEmptyVariantTypeNode( 'EnumEmptyVariantTypeNode must have a name.' ); } - return { - kind: 'enumEmptyVariantTypeNode', - name: mainCase(name), - } as EnumEmptyVariantTypeNode; + return { kind: 'enumEmptyVariantTypeNode', name: mainCase(name) }; } export function enumEmptyVariantTypeNodeFromIdl( diff --git a/src/nodes/typeNodes/EnumStructVariantTypeNode.ts b/src/nodes/typeNodes/EnumStructVariantTypeNode.ts index 4cc9e00d5..520d8181c 100644 --- a/src/nodes/typeNodes/EnumStructVariantTypeNode.ts +++ b/src/nodes/typeNodes/EnumStructVariantTypeNode.ts @@ -4,7 +4,6 @@ import type { Node } from '../Node'; import { StructTypeNode, structTypeNodeFromIdl } from './StructTypeNode'; export type EnumStructVariantTypeNode = { - readonly __enumStructVariantTypeNode: unique symbol; readonly kind: 'enumStructVariantTypeNode'; readonly name: MainCaseString; readonly struct: StructTypeNode; @@ -19,11 +18,7 @@ export function enumStructVariantTypeNode( 'EnumStructVariantTypeNode must have a name.' ); } - return { - kind: 'enumStructVariantTypeNode', - name: mainCase(name), - struct, - } as EnumStructVariantTypeNode; + return { kind: 'enumStructVariantTypeNode', name: mainCase(name), struct }; } export function enumStructVariantTypeNodeFromIdl( diff --git a/src/nodes/typeNodes/EnumTupleVariantTypeNode.ts b/src/nodes/typeNodes/EnumTupleVariantTypeNode.ts index 8b1efac2b..645dd8519 100644 --- a/src/nodes/typeNodes/EnumTupleVariantTypeNode.ts +++ b/src/nodes/typeNodes/EnumTupleVariantTypeNode.ts @@ -4,7 +4,6 @@ import type { Node } from '../Node'; import { TupleTypeNode, tupleTypeNodeFromIdl } from './TupleTypeNode'; export type EnumTupleVariantTypeNode = { - readonly __enumTupleVariantTypeNode: unique symbol; readonly kind: 'enumTupleVariantTypeNode'; readonly name: MainCaseString; readonly tuple: TupleTypeNode; @@ -19,11 +18,7 @@ export function enumTupleVariantTypeNode( 'EnumTupleVariantTypeNode must have a name.' ); } - return { - kind: 'enumTupleVariantTypeNode', - name: mainCase(name), - tuple, - } as EnumTupleVariantTypeNode; + return { kind: 'enumTupleVariantTypeNode', name: mainCase(name), tuple }; } export function enumTupleVariantTypeNodeFromIdl( diff --git a/src/nodes/typeNodes/EnumTypeNode.ts b/src/nodes/typeNodes/EnumTypeNode.ts index 65e8e6f96..f731fe123 100644 --- a/src/nodes/typeNodes/EnumTypeNode.ts +++ b/src/nodes/typeNodes/EnumTypeNode.ts @@ -7,7 +7,6 @@ import type { Node } from '../Node'; import { NumberTypeNode, numberTypeNode } from './NumberTypeNode'; export type EnumTypeNode = { - readonly __enumTypeNode: unique symbol; readonly kind: 'enumTypeNode'; readonly variants: EnumVariantTypeNode[]; readonly size: NumberTypeNode; @@ -21,7 +20,7 @@ export function enumTypeNode( kind: 'enumTypeNode', variants, size: options.size ?? numberTypeNode('u8'), - } as EnumTypeNode; + }; } export function enumTypeNodeFromIdl(idl: IdlTypeEnum): EnumTypeNode { diff --git a/src/nodes/typeNodes/LinkTypeNode.ts b/src/nodes/typeNodes/LinkTypeNode.ts index b62624090..a6d8d7d31 100644 --- a/src/nodes/typeNodes/LinkTypeNode.ts +++ b/src/nodes/typeNodes/LinkTypeNode.ts @@ -2,7 +2,6 @@ import { ImportFrom, MainCaseString, mainCase } from '../../shared'; import type { Node } from '../Node'; export type LinkTypeNode = { - readonly __linkTypeNode: unique symbol; readonly kind: 'linkTypeNode'; readonly name: MainCaseString; readonly importFrom: ImportFrom; @@ -21,7 +20,7 @@ export function linkTypeNode( name: mainCase(name), importFrom: options.importFrom ?? 'generated', size: options.size, - } as LinkTypeNode; + }; } export function isLinkTypeNode(node: Node | null): node is LinkTypeNode { diff --git a/src/nodes/typeNodes/MapTypeNode.ts b/src/nodes/typeNodes/MapTypeNode.ts index cf68be8de..3c148b414 100644 --- a/src/nodes/typeNodes/MapTypeNode.ts +++ b/src/nodes/typeNodes/MapTypeNode.ts @@ -10,7 +10,6 @@ import { numberTypeNode } from './NumberTypeNode'; import { TypeNode, createTypeNodeFromIdl } from './TypeNode'; export type MapTypeNode = { - readonly __mapTypeNode: unique symbol; readonly kind: 'mapTypeNode'; readonly key: TypeNode; readonly value: TypeNode; @@ -32,7 +31,7 @@ export function mapTypeNode( value, size: options.size ?? prefixedSize(), idlMap: options.idlMap ?? 'hashMap', - } as MapTypeNode; + }; } export function mapTypeNodeFromIdl(idl: IdlTypeMap): MapTypeNode { diff --git a/src/nodes/typeNodes/NumberTypeNode.ts b/src/nodes/typeNodes/NumberTypeNode.ts index f3f79ad35..ef57ae15f 100644 --- a/src/nodes/typeNodes/NumberTypeNode.ts +++ b/src/nodes/typeNodes/NumberTypeNode.ts @@ -15,7 +15,6 @@ export type NumberFormat = | 'f64'; export type NumberTypeNode = { - readonly __numberTypeNode: unique symbol; readonly kind: 'numberTypeNode'; readonly format: NumberFormat; readonly endian: 'le' | 'be'; @@ -25,7 +24,7 @@ export function numberTypeNode( format: NumberFormat, endian: 'le' | 'be' = 'le' ): NumberTypeNode { - return { kind: 'numberTypeNode', format, endian } as NumberTypeNode; + return { kind: 'numberTypeNode', format, endian }; } export function isSignedInteger(node: NumberTypeNode): boolean { diff --git a/src/nodes/typeNodes/OptionTypeNode.ts b/src/nodes/typeNodes/OptionTypeNode.ts index ee64ab765..f59d4a9ad 100644 --- a/src/nodes/typeNodes/OptionTypeNode.ts +++ b/src/nodes/typeNodes/OptionTypeNode.ts @@ -4,7 +4,6 @@ import { NumberTypeNode, numberTypeNode } from './NumberTypeNode'; import { TypeNode, createTypeNodeFromIdl } from './TypeNode'; export type OptionTypeNode = { - readonly __optionTypeNode: unique symbol; readonly kind: 'optionTypeNode'; readonly child: TypeNode; readonly prefix: NumberTypeNode; @@ -26,7 +25,7 @@ export function optionTypeNode( prefix: options.prefix ?? numberTypeNode('u8'), fixed: options.fixed ?? false, idlOption: options.idlOption ?? 'option', - } as OptionTypeNode; + }; } export function optionTypeNodeFromIdl(idl: IdlTypeOption): OptionTypeNode { diff --git a/src/nodes/typeNodes/PublicKeyTypeNode.ts b/src/nodes/typeNodes/PublicKeyTypeNode.ts index 0cdbc7500..b96e72188 100644 --- a/src/nodes/typeNodes/PublicKeyTypeNode.ts +++ b/src/nodes/typeNodes/PublicKeyTypeNode.ts @@ -1,12 +1,11 @@ import type { Node } from '../Node'; export type PublicKeyTypeNode = { - readonly __publicKeyTypeNode: unique symbol; readonly kind: 'publicKeyTypeNode'; }; export function publicKeyTypeNode(): PublicKeyTypeNode { - return { kind: 'publicKeyTypeNode' } as PublicKeyTypeNode; + return { kind: 'publicKeyTypeNode' }; } export function isPublicKeyTypeNode( diff --git a/src/nodes/typeNodes/SetTypeNode.ts b/src/nodes/typeNodes/SetTypeNode.ts index 91fe02016..b5b7a84ad 100644 --- a/src/nodes/typeNodes/SetTypeNode.ts +++ b/src/nodes/typeNodes/SetTypeNode.ts @@ -10,7 +10,6 @@ import { numberTypeNode } from './NumberTypeNode'; import { TypeNode, createTypeNodeFromIdl } from './TypeNode'; export type SetTypeNode = { - readonly __setTypeNode: unique symbol; readonly kind: 'setTypeNode'; readonly child: TypeNode; readonly size: SizeStrategy; @@ -29,7 +28,7 @@ export function setTypeNode( child, size: options.size ?? prefixedSize(), idlSet: options.idlSet ?? 'hashSet', - } as SetTypeNode; + }; } export function setTypeNodeFromIdl(idl: IdlTypeSet): SetTypeNode { diff --git a/src/nodes/typeNodes/StringTypeNode.ts b/src/nodes/typeNodes/StringTypeNode.ts index e05a1dd97..62a81aeee 100644 --- a/src/nodes/typeNodes/StringTypeNode.ts +++ b/src/nodes/typeNodes/StringTypeNode.ts @@ -8,7 +8,6 @@ import type { Node } from '../Node'; export type StringEncoding = 'utf8' | 'base16' | 'base58' | 'base64'; export type StringTypeNode = { - readonly __stringTypeNode: unique symbol; readonly kind: 'stringTypeNode'; readonly encoding: StringEncoding; readonly size: SizeStrategy; @@ -24,7 +23,7 @@ export function stringTypeNode( kind: 'stringTypeNode', encoding: options.encoding ?? 'utf8', size: options.size ?? prefixedSize(), - } as StringTypeNode; + }; } export function displayStringTypeNode(node: StringTypeNode): string { diff --git a/src/nodes/typeNodes/StructFieldTypeNode.ts b/src/nodes/typeNodes/StructFieldTypeNode.ts index a0f10dc16..5a5744483 100644 --- a/src/nodes/typeNodes/StructFieldTypeNode.ts +++ b/src/nodes/typeNodes/StructFieldTypeNode.ts @@ -5,7 +5,6 @@ import { TypeNode, createTypeNodeFromIdl } from './TypeNode'; import { ValueNode, vScalar } from '../ValueNode'; export type StructFieldTypeNode = { - readonly __structFieldTypeNode: unique symbol; readonly kind: 'structFieldTypeNode'; readonly name: MainCaseString; readonly child: TypeNode; @@ -35,7 +34,7 @@ export function structFieldTypeNode( child: input.child, docs: input.docs ?? [], defaultsTo: input.defaultsTo ?? null, - } as StructFieldTypeNode; + }; } export function structFieldTypeNodeFromIdl( diff --git a/src/nodes/typeNodes/StructTypeNode.ts b/src/nodes/typeNodes/StructTypeNode.ts index a0c060386..1cca71269 100644 --- a/src/nodes/typeNodes/StructTypeNode.ts +++ b/src/nodes/typeNodes/StructTypeNode.ts @@ -6,13 +6,12 @@ import { } from './StructFieldTypeNode'; export type StructTypeNode = { - readonly __structTypeNode: unique symbol; readonly kind: 'structTypeNode'; readonly fields: StructFieldTypeNode[]; }; export function structTypeNode(fields: StructFieldTypeNode[]): StructTypeNode { - return { kind: 'structTypeNode', fields } as StructTypeNode; + return { kind: 'structTypeNode', fields }; } export function structTypeNodeFromIdl(idl: IdlTypeStruct): StructTypeNode { diff --git a/src/nodes/typeNodes/TupleTypeNode.ts b/src/nodes/typeNodes/TupleTypeNode.ts index b8b14b880..0a3dd16fc 100644 --- a/src/nodes/typeNodes/TupleTypeNode.ts +++ b/src/nodes/typeNodes/TupleTypeNode.ts @@ -3,7 +3,6 @@ import type { Node } from '../Node'; import { TypeNode, createTypeNodeFromIdl } from './TypeNode'; export type TupleTypeNode = { - readonly __tupleTypeNode: unique symbol; readonly kind: 'tupleTypeNode'; readonly children: TypeNode[]; }; @@ -11,9 +10,7 @@ export type TupleTypeNode = { export function tupleTypeNode( children: [...TItems] ): TupleTypeNode & { readonly children: [...TItems] } { - return { kind: 'tupleTypeNode', children } as TupleTypeNode & { - readonly children: [...TItems]; - }; + return { kind: 'tupleTypeNode', children }; } export function tupleTypeNodeFromIdl(idl: IdlTypeTuple): TupleTypeNode {