-
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.
feat: Optional type is no longer exported
- Loading branch information
Showing
4 changed files
with
20 additions
and
15 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 |
---|---|---|
@@ -1 +1,16 @@ | ||
export type ResultType = 'ok' | 'err'; | ||
|
||
/** | ||
* JavaScript ECMAScript 2020 contains two new proposals that can help us deal with undefined/null more easily: | ||
* - https://github.com/tc39/proposal-optional-chaining | ||
* - https://github.com/tc39/proposal-nullish-coalescing | ||
* | ||
* We don't need Rust-like Option anymore in most cases unless we want functional programming. | ||
* | ||
* This type doesn't use the name `Option`, | ||
* by giving it a different name we can easily know that this is not Rust-like Option. | ||
* | ||
* This type is not exported since there's no convention for using `Optional` type in TypeScript world. | ||
* People just simply write `T | undefined`. | ||
*/ | ||
export type Optional<T> = T | undefined; |
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