-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed the utility type `NodeIsHelper` to `PotentiallyReadonly` and improved documentation and tests.
- Loading branch information
Showing
7 changed files
with
55 additions
and
23 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
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 { describe, it } from 'mocha' | ||
import type { | ||
AstNode, | ||
CommentNode, | ||
DeepReadonly, | ||
PotentiallyReadonly, | ||
} from '../../lib' | ||
import { assertType, typing } from '../utils.js' | ||
|
||
describe('common util', () => { | ||
typing('PotentiallyReadonly', () => { | ||
type UndefinedNode = PotentiallyReadonly<CommentNode, undefined> | ||
type ReadonlyNode = PotentiallyReadonly< | ||
CommentNode, | ||
DeepReadonly<AstNode> | ||
> | ||
type ReadWriteNode = PotentiallyReadonly<CommentNode, AstNode> | ||
assertType<never>(0 as unknown as UndefinedNode) | ||
assertType<DeepReadonly<CommentNode>>(0 as unknown as ReadonlyNode) | ||
assertType<CommentNode>(0 as unknown as ReadWriteNode) | ||
}) | ||
}) |
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