From 074fc5db985e4f78cfc0ef1dd396b00b7fd7cb91 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 25 Feb 2021 11:33:11 +0100 Subject: [PATCH] Loosen type of constructor, to allow patterns as well as values --- implementations/javascript/src/record.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/implementations/javascript/src/record.ts b/implementations/javascript/src/record.ts index 825b9ce..72c0aa5 100644 --- a/implementations/javascript/src/record.ts +++ b/implementations/javascript/src/record.ts @@ -71,11 +71,11 @@ export class Record extends Array> { }).join(', ') + ')'; } - static makeConstructor(labelSymbolText: string, fieldNames: string[]): RecordConstructor { + static makeConstructor(labelSymbolText: string, fieldNames: string[]): RecordConstructor { return Record.makeBasicConstructor(Symbol.for(labelSymbolText), fieldNames); } - static makeBasicConstructor(label: Value, fieldNames: string[]): RecordConstructor { + static makeBasicConstructor(label: Value, fieldNames: string[]): RecordConstructor { const arity = fieldNames.length; const ctor: RecordConstructor = (...fields: Value[]): Record => { if (fields.length !== arity) {