-
-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com> Co-authored-by: Dimitri Benin <BendingBender@users.noreply.github.com>
- Loading branch information
1 parent
8b8dd4d
commit 681f59b
Showing
3 changed files
with
55 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
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,13 @@ | ||
import {expectType} from 'tsd'; | ||
import {Opaque} from '..'; | ||
|
||
type Value = Opaque<number>; | ||
|
||
// We make an explicit cast so we can test the value. | ||
const value: Value = 2 as Value; | ||
|
||
// Every opaque type should have a private symbol member, so the compiler can differentiate separate opaque types. | ||
expectType<symbol>(value.__opaque__); | ||
|
||
// The underlying type of the value is still a number. | ||
expectType<number>(value); |