forked from sindresorhus/type-fest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted from sindresorhus/electron-util#11
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* eslint-disable import/no-unassigned-import */ | ||
import './test/omit'; | ||
import './test/merge'; | ||
import './test/require-at-least-one'; | ||
|
||
// TODO: Add negative tests. Blocked by: https://github.com/SamVerschueren/tsd-check/issues/2 |
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,22 @@ | ||
import {RequireAtLeastOne} from '..'; | ||
|
||
type SystemMessages = { | ||
macos?: string; | ||
linux?: string; | ||
windows?: string; | ||
default?: string; | ||
}; | ||
|
||
type ValidMessages = RequireAtLeastOne<SystemMessages, 'macos' | 'linux' | 'windows'>; | ||
const test = (_: ValidMessages[]): void => {}; | ||
|
||
test([ | ||
{macos: 'hey'}, | ||
{macos: 'hey', default: 'hello'}, | ||
{linux: 'sup', windows: 'hi'}, | ||
{macos: 'hey', linux: 'sup', windows: 'hi', default: 'hello'} | ||
|
||
// Negative examples: | ||
// {}, | ||
// {default: 'hello'}, | ||
]); |