Presently, I have the following:
interface Obj {
foo: string,
bar: number,
baz: boolean
}
The desired outcome is to convert this interface into the tuple format below:
[string, number, boolean]
Is there a way to achieve this conversion?
Update:
I am encountering an issue with my current project: I am developing a library that follows a declarative approach, where users need to specify function parameters in an object literal. For example:
let paramsDeclaration = {
param1: {
value: REQUIRED<string>(),
shape: (v) => typeof v === 'string' && v.length < 10
},
param2: {
value: OPTIONAL<number>(),
...
},
}
Subsequently, the library takes this object and generates a function with parameters based on it:
(param1: string, param2?: number) => ...
Hence, creating such a function is not the main concern; rather, accurately typing it so that users can benefit from effective code completion (IntelliSense).
P.S. While I understand this may not be fully solvable, I am curious to explore potential workarounds or hacks.