-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Description
TypeScript Version: 4.0.2
Search Terms:
callable
Code
type Retrieve = () => {
extracted?: string
raw: string
}
const retrieve: Retrieve = () => {
return {
raw: 'mhm',
extracted: 'aha',
a: 1, // no error for this extra prop
}
}
interface RetrieveInterface {
(): {
extracted?: string
raw: string
}
}
const retrieveInterface: RetrieveInterface = () => {
return {
raw: 'mhm',
extracted: 'aha',
a: 1, // no error for this extra prop
}
}
Expected behavior:
get same error as setting return type to arrow function
const retrieve = (): {
extracted?: string
raw: string
} => {
return {
raw: 'mhm',
extracted: 'aha',
a: 1,
}
}
Actual behavior:
no error
Related Issues:
Maybe I hit same as on going discussion here -> #241
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdFix AvailableA PR has been opened for this issueA PR has been opened for this issue