Skip to content

Cannot 'implement' Person from class #28

@vandijkstef

Description

@vandijkstef

When I try to implement 'Person' on a class like:

import { Person as PersonSchema }  from 'schema-dts';
export class Person implements PersonSchema { ... }

TS errors with

A class can only implement an object type or intersection of object types with statically known members.

Which can be solved by editing this snippet:

export declare type Person = ({
    "@type": "Person";
} & PersonBase) | Patient;

to

export declare type Person = ({
    "@type": "Person";
} & PersonBase);

Obviously, this case is true for any type declaration in the pattern (...) | [TYPE]. The same applies to extending interfaces.
What is the reason for this pattern? Is it intended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions