Skip to content
Myr

fix(types): strip extra properties from array types in JSONParsed (#5103)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by arman-luthra · committed by GitHub · parent b93a254 · Browse files · 2 files+15 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+15 added−1 removed

  • tests:+10 added−0 removed
  • other:+5 added−1 removed

2 files+15 added−1 removed

modified:src/utils/types.test.ts+10 added
114 unmodified lines
115 type Actual = JSONParsed<{ key: readonly number[] }>116 type Expected = { key: readonly number[] }117 expectTypeOf<Actual>().toEqualTypeOf<Expected>()118 })119 it('should convert T[] with additional properties to T[]', () => {120 type Actual = JSONParsed<{ foo: 'bar' }[] & { meta: 'v1' }>121 type Expected = { foo: 'bar' }[]122 expectTypeOf<Actual>().toEqualTypeOf<Expected>()123 })124 it('should convert elements of T[] with additional properties', () => {125 type Actual = JSONParsed<(number | undefined)[] & { meta: 'v1' }>126 type Expected = (number | null)[]127 expectTypeOf<Actual>().toEqualTypeOf<Expected>()128 })129 })130131 describe('tuple', () => {132 it('should convert [T, S] type to [T, S]', () => {
162 unmodified lines
modified:src/utils/types.ts+5 added-1 removed