Open this example in the interactive library
Source code
interface Named {
name: string;
}
console.log(
(() => {
class Item {
constructor(public name: string) {}
}
const args: ConstructorParameters<typeof Item> = ["api"];
return new Item(...args).name;
})(),
);
Sample output
api
