Skip to content

Unknown keys on instance should not be typed as any when instantiating from Base.defaults() or Base.plugin() #31

Closed
@gr2m

Description

@gr2m

Example

const base = new Base()

// TS complains as expected
base.unknown

const BaseWithDefaults = Base.defaults({})
const baseWithDefaults = new BaseWithDefaults

// TS does _not_ complain, `.unknown` is typed as `any`, and it shouldn't
baseWithDefaults.unknown

The problems are these two lines from the resulting .d.ts file

I don't quite understand whey they are coming from, and how I can change them to at least [x: string]: unknown.

Any idea?

Here is a playground with the full source code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions