Skip to content

rd-dev-ukraine/rd-url-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

defineAction

defineAction<TActionData> - allows to define a simple action creator which produces actions with specified props.

const MyAction = defineAction<{ value: number; }>("MY ACTION");

Now action creator could be used for creating actions:

const actionInstance = MyAction({ value: 123 });
console.log(actionInstance.value); // Outputs 123

Also action creator could be used for checking actions for conforming a type:

const action: Action = ...
if (MyAction.is(action)) {
    console.log(action.value); // action variable type now shrinked to { type: string; value: number }
}

About

Operate with URLs in your application in typed way

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published