Hi! Im trying to create a type which is an object and can hold any key except "data"
type ObjectWithoutData = {
[key: string]: any;
} & {
data?: never;
};
const x: ObjectWithoutData = {
test: "hello",
data: "test" // ERRORS which is what I want!
};
let y: any = {}
y["test"] = x.data; // Doesnt error :/
I've got something like this but you can still access x.data, now I know that the assignment works because it's optional but if you make it not optional then you need to include it which I also dont want.... is there any solution to this?