How I can do this?
type Module = {
created: number;
}
class Example {
constructor(
public readonly moduleName: string
) { }
getModule = (modules: {
[this.moduleName]: Module // <-- property error
}) => modules[this.moduleName]
}
property error is "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type."
The playground is here