-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
Milestone
Description
To repro: go to DefinitelyTyped/types/meteor-astronomy and tsc. The excess property error only happens when the target type is any.
// @Filename: meteor.d.ts
interface User {
_id: string;
username?: string;
emails?: UserEmail[];
createdAt?: Date;
profile?: any;
services?: any;
}
// @Filename: meteor-astronomy.d.ts
// .... snip ...
interface UserInterface extends Meteor.User {
address: object;
firstName: string;
lastName: string;
phone: string;
phoneNumber: string;
fullName: (param: string) => string;
}
const User = Class.create<UserInterface>({
name: 'User',
collection: Meteor.users as unknown as Mongo.Collection<UserInterface>,
fields: {
createdAt: Number,
emails: {
type: [Object],
default: (): Meteor.UserEmail[] => [],
},
profile: { // excess property here
type: UserProfile,
default: () => {},
},
address: {
type: Object,
optional: true
},
firstName: String,
lastName: String,
phone: {
type: String,
resolve(doc: UserInterface) {
return doc.phoneNumber;
},
},
phoneNumber: {
type: String,
},
},
// ...Expected behavior:
No excess property error.
Actual behavior:
Excess property error. Changing the type of User.profile to unknown (or any other type) makes the error go away.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.