Closed as not planned
Closed as not planned
Description
Bug Report
π Search Terms
- Function return
- Object
- Property
- Properties
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about object properties.
β― Playground Link
Playground link with relevant code
π» Code
interface Test {
a?: string;
b?: string;
c?: string;
}
const func: () => Test = () => ({
a: "",
// This property should throw an error
d: ""
});
π Actual behavior
The compiler does not throw any errors, allowing the function to return an object with properties that are not present in interface Test
.
π Expected behavior
The compiler should throw an error since property d
does not exist on interface Test
.
Metadata
Metadata
Assignees
Labels
No labels