diff --git a/packages/typescript/src/interface-factory.ts b/packages/typescript/src/interface-factory.ts index f7ceea3..62238fa 100644 --- a/packages/typescript/src/interface-factory.ts +++ b/packages/typescript/src/interface-factory.ts @@ -289,7 +289,7 @@ function* buildType(type: Type): Iterable { const recordType = `Record<${keyTypeName}, ${Array.from(typeNames) .sort() - .join(' | ')}>`; + .join(' | ')} ${mapValue.value.isNullable ? ` | null` : ''}>`; yield isEnumKey ? `Partial<${recordType}>` : recordType; } diff --git a/packages/typescript/src/spec/4.1-structure/4.1.12-primitive-value.spec.ts b/packages/typescript/src/spec/4.1-structure/4.1.12-primitive-value.spec.ts index 02ccf95..710317d 100644 --- a/packages/typescript/src/spec/4.1-structure/4.1.12-primitive-value.spec.ts +++ b/packages/typescript/src/spec/4.1-structure/4.1.12-primitive-value.spec.ts @@ -241,9 +241,7 @@ describe('4.1.12 Primitive Value', () => { ); }); - // TODO: fix and enable these tests - // https://github.com/basketry/typescript/issues/139 - describe.skip('map property value', () => { + describe('map property value', () => { it.each(typeMap)( 'emits nullable `%s` as a union of `%s` and null', async (primitive, expectedType) => { @@ -407,9 +405,7 @@ describe('4.1.12 Primitive Value', () => { ); }); - // TODO: fix and enable these tests - // https://github.com/basketry/typescript/issues/139 - describe.skip('map property value', () => { + describe('map property value', () => { it.each(typeMap)( 'emits `%s` as a union of `%s` array and null', async (primitive, expectedType) => { @@ -577,9 +573,7 @@ describe('4.1.12 Primitive Value', () => { ); }); - // TODO: fix and enable these tests - // https://github.com/basketry/typescript/issues/139 - describe.skip('map property value', () => { + describe('map property value', () => { it.each(typeMap)( 'emits nullable `%s` as a union of `%s` and null', async (primitive, expectedType) => { @@ -665,9 +659,7 @@ describe('4.1.12 Primitive Value', () => { ); }); - // TODO: fix and enable these tests - // https://github.com/basketry/typescript/issues/139 - describe.skip('map property value', () => { + describe('map property value', () => { it.each(typeMap)( 'emits `%s` as a union of `%s` array and null', async (primitive, expectedType) => {