My goal is to have an object with attributes part of a typescript string enum.
type PARAM = "long-parameter" | "long-parameter2";
const PARAM = {
param1: "long-parameter" as PARAM,
param2: "long-parameter2" as PARAM,
}
var f = function(params:{[id:PARAM]:number}){}
f({ //must be valid
[PARAM.param1]:1,
});
f({ //should display error
"asdas":1
});
The problem is that var f = function(params:{[id:PARAM]:number}){} returns the error An index signature parameter type must be string or number.
Is there any way around that?
