Skip to content

Commit

Permalink
fixed star projection option being required (#29)
Browse files Browse the repository at this point in the history
Fixed star projection being optional + added a couple of typing tests for it
  • Loading branch information
toptobes authored Apr 16, 2024
1 parent 9173b3c commit 49c1848
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/data-api/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export type StrictProjection<Schema extends SomeDoc> = {
? 1 | 0 | true | false | ProjectionSlice
: 1 | 0 | true | false;
} & {
'*': 1 | 0 | true | false;
'*'?: 1 | 0 | true | false;
};

/**
Expand Down
9 changes: 9 additions & 0 deletions tests/typing/strict-projection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ const test4: StrictProjection<Schema> = {
const test5: StrictProjection<ConvolutedSchema2> = {
numOrArray: { $slice: [1, 3] },
}

const test6: StrictProjection<ConvolutedSchema2> = {
numOrArray: { $slice: [1, 3] },
'*': 1,
}

const test7: StrictProjection<ConvolutedSchema2> = {
'*': false,
}

0 comments on commit 49c1848

Please sign in to comment.