type Foo = { [key in `prefix${string}`]: number };
const bar = { test: 1 };
const foo: Foo = bar; // I want an error here
The project uses JSDoc comments and an index.d.ts file.
I have read https://github.com/microsoft/TypeScript/issues/12936 and couldn't find an utility that worked.
i.e. it should set all other properties to never and work when assigning a variable—not an object literal.
GitHub
This is a proposal to enable a syntax for exact types. A similar feature can be seen in Flow (https://flowtype.org/docs/objects.html#exact-object-types), but I would like to propose it as a feature...