ianstormtaylor/superstruct

Mask fails on `interface aaa { foo: string; [key: string]: any }` interface with any key.

oleg-slapdash opened this issue · 0 comments

This code throws an error, while this is a valid typescript code:

const interfaceWithAKnownKey = intersection([
  record(string(), any()),
  object({
    foo: string(),
  }),
]);

// Typescript: No ERROR.
const test: typeof interfaceWithAKnownKey.TYPE = {
  foo: "bar",
  extra: "buzz",
};

// StructError: At path: extra -- Expected a value of type `never`, but received: `"buzz"`
interfaceWithAKnownKey.mask(test);