Skip to content

Commit e062218

Browse files
authored
Fixes ordering of NonMaybeType so it affects the batch property and not the element (#341)
1 parent cb691fd commit e062218

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

__tests__/genTypeFlow.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ it('getLoaderTypeKey forces a nullable batchKey to be strictly non-nullable', ()
3939
[$PropertyType<$PropertyType<ResourcesType, 'a'>, 'b'>]
4040
>, 'test_ids'>
4141
}>,
42-
...{| test_id: $NonMaybeType<$ElementType<$PropertyType< $Call<
42+
...{| test_id: $ElementType<$NonMaybeType<$PropertyType< $Call<
4343
ExtractArg,
4444
[$PropertyType<$PropertyType<ResourcesType, 'a'>, 'b'>]
45-
>, 'test_ids'>, 0>> |}
45+
>, 'test_ids'>>, 0> |}
4646
|}`);
4747
});

src/genTypeFlow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function getLoaderTypeKey(resourceConfig: ResourceConfig, resourcePath: R
5656
if (resourceConfig.isBatchResource) {
5757
// Extract newKeyType from the batch key's Array's type
5858
// We add NonMaybeType before batch key element type to force the batch key to be required, regardless if the OpenAPI spec specifies it as being optional
59-
let newKeyType = `${resourceConfig.newKey}: $NonMaybeType<$ElementType<$PropertyType<${resourceArgs}, '${resourceConfig.batchKey}'>, 0>>`;
59+
let newKeyType = `${resourceConfig.newKey}: $ElementType<$NonMaybeType<$PropertyType<${resourceArgs}, '${resourceConfig.batchKey}'>>, 0>`;
6060

6161
if (resourceConfig.isBatchKeyASet) {
6262
/**

0 commit comments

Comments
 (0)