-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retain struct's type in partial and pick helpers (#1149)
* Retain struct's type in partial and pick helpers * Refactor for clarity Refactors partial helper to more directly reflect its internal logic including schema shorthand usage.
- Loading branch information
1 parent
a4c2ebd
commit 4511928
Showing
4 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { number, partial, string, type } from '../../../src' | ||
|
||
export const Struct = partial( | ||
type({ | ||
name: string(), | ||
age: number(), | ||
}) | ||
) | ||
|
||
export const data = { | ||
name: 'john', | ||
unknownProperty: true, | ||
} | ||
|
||
export const output = { | ||
name: 'john', | ||
unknownProperty: true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { number, pick, string, type } from '../../../src' | ||
|
||
export const Struct = pick( | ||
type({ | ||
name: string(), | ||
age: number(), | ||
}), | ||
['name'] | ||
) | ||
|
||
export const data = { | ||
name: 'john', | ||
unknownProperty: true, | ||
} | ||
|
||
export const output = { | ||
name: 'john', | ||
unknownProperty: true, | ||
} |