ronami / meta-typing Goto Github PK
View Code? Open in Web Editor NEW๐ Functions and algorithms implemented purely with TypeScript's type system
License: MIT License
๐ Functions and algorithms implemented purely with TypeScript's type system
License: MIT License
Good afternoon. Great repository, thanks.
This question sounds more like a request for help. If you have the time and desire to help.
I'm doing a library that helps with organizing logic and business tasks.
https://github.com/avil13/vue-act-master
And I'm having a serious problem.
I create an action, and I call it through the manager.
But when I call it, I can't get the return type of the function.
Example code:
import { ActMaster, ActMasterAction } from 'act-master';
class GetUserAction implements ActMasterAction {
name = 'get.user';
async exec() {
return { name: 'My Name' }
}
}
const actions: actMasterAction[] = [new GetUserAction()];
constMaster = new ActMaster({
actions,
});
// Here is the gist of this question
// I would like the names of the actions to be prompted
// and the type of result return
actMaster.exec('get.user');
Is it possible to create a declaration based on code?
Or create an interface that tells you the name of the action and the return result.
I tried to do something like that, but the attempt failed.
interface ActionList {
'get.user': { name: string };
}
type exec = (name: keyof ActionList) => ActionList[keyof ActionList];
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.