-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
π Search Terms
record type enforcement strict parameters
π Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about Record, Exclude, etc.
β― Playground Link
π» Code
const recordFunction = (param: Record<number, number>) => {};
recordFunction({ this: 'is', not: 'a', record: '?' }); // Fails, as expected
const y = { this: 'is', not: 'a', record: '?' };
recordFunction(y); // Passes incorrectly
π Actual behavior
No error is raised by TypeScript. This allows for almost any object to be passed to a function that expects a Record, which will miss finding developer errors and may result in significant inconsistencies at runtime.
π Expected behavior
I expect an error be raised.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
No labels