-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor:
AllActivityName
-> `RegisteredActivityName
- Loading branch information
1 parent
5f28bce
commit dabb4c7
Showing
10 changed files
with
39 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import type { ActivityLoaderArgs } from "./ActivityLoaderArgs"; | ||
import type { AllActivityName } from "./AllActivityName"; | ||
import type { RegisteredActivityName } from "./RegisteredActivityName"; | ||
|
||
export type ActivityLoader<ActivityName extends AllActivityName> = ( | ||
export type ActivityLoader<ActivityName extends RegisteredActivityName> = ( | ||
args: ActivityLoaderArgs<ActivityName>, | ||
) => any; |
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,9 +1,11 @@ | ||
import type { ActivityDefinition } from "./ActivityDefinition"; | ||
import type { AllActivityName } from "./AllActivityName"; | ||
import type { Config } from "./Config"; | ||
import type { InferActivityParams } from "./InferActivityParams"; | ||
import type { RegisteredActivityName } from "./RegisteredActivityName"; | ||
|
||
export interface ActivityLoaderArgs<ActivityName extends AllActivityName> { | ||
export interface ActivityLoaderArgs< | ||
ActivityName extends RegisteredActivityName, | ||
> { | ||
params: InferActivityParams<ActivityName>; | ||
config: Config<ActivityDefinition<AllActivityName>>; | ||
config: Config<ActivityDefinition<RegisteredActivityName>>; | ||
} |
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,8 +1,8 @@ | ||
import type { ActivityBaseParams } from "./ActivityBaseParams"; | ||
import type { AllActivityName } from "./AllActivityName"; | ||
import type { RegisteredActivityName } from "./RegisteredActivityName"; | ||
import type { RegisteredActivityParamTypes } from "./RegisteredActivityParamTypes"; | ||
|
||
export type InferActivityParams<ActivityName extends AllActivityName> = | ||
export type InferActivityParams<ActivityName extends RegisteredActivityName> = | ||
RegisteredActivityParamTypes[ActivityName] extends never | ||
? ActivityBaseParams | ||
: RegisteredActivityParamTypes[ActivityName]; |
2 changes: 1 addition & 1 deletion
2
config/src/AllActivityName.ts → config/src/RegisteredActivityName.ts
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,6 +1,6 @@ | ||
import type { RegisteredActivityParamTypes } from "./RegisteredActivityParamTypes"; | ||
|
||
export type AllActivityName = Extract< | ||
export type RegisteredActivityName = Extract< | ||
keyof RegisteredActivityParamTypes, | ||
string | ||
>; |
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,5 +1,8 @@ | ||
import type { AllActivityName, InferActivityParams } from "@stackflow/config"; | ||
import type { | ||
InferActivityParams, | ||
RegisteredActivityName, | ||
} from "@stackflow/config"; | ||
import type React from "react"; | ||
|
||
export type ActivityComponentType<ActivityName extends AllActivityName> = | ||
export type ActivityComponentType<ActivityName extends RegisteredActivityName> = | ||
React.ComponentType<{ params: InferActivityParams<ActivityName> }>; |
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