Skip to content

meteor/meteor-astronomy: bogus excess property error after #42248 #42336

@sandersn

Description

@sandersn

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 TypeScriptFix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions