-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@molt/command): hide private property on exclusive builder (#262)
- Loading branch information
1 parent
09b340c
commit 2832cb6
Showing
6 changed files
with
80 additions
and
64 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
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,27 +1,19 @@ | ||
import type { ParameterExclusiveInput } from '../../Parameter/exclusive.js' | ||
import type { BuilderCommandState } from '../command/state.js' | ||
|
||
export const ExclusiveBuilderStateSymbol = Symbol(`ExclusiveBuilderState`) | ||
export type ExclusiveBuilderStateSymbol = typeof ExclusiveBuilderStateSymbol | ||
|
||
export type BuilderParameterExclusiveState< | ||
$State extends BuilderCommandState.Base = BuilderCommandState.Base, | ||
> = { | ||
/** | ||
* Used for build time. Type inference functionality. | ||
*/ | ||
typeState: $State | ||
/** | ||
* Used for runtime. | ||
*/ | ||
input: ParameterExclusiveInput<$State> | ||
} | ||
$State extends BuilderCommandState.Base = BuilderCommandState.BaseEmpty, | ||
> = ParameterExclusiveInput<$State> & { commandBuilderState: $State } | ||
|
||
export const createState = (label: string): BuilderParameterExclusiveState => { | ||
return { | ||
typeState: undefined as any, // eslint-disable-line | ||
input: { | ||
label, | ||
_tag: `Exclusive`, | ||
optionality: { _tag: `required` }, | ||
parameters: [], | ||
} satisfies ParameterExclusiveInput, | ||
label, | ||
_tag: `Exclusive`, | ||
optionality: { _tag: `required` }, | ||
parameters: [], | ||
commandBuilderState: undefined as any, // eslint-disable-line | ||
} | ||
} |
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