sindresorhus/type-fest

`NonEmptyObject` fails for objects with dynamic properties

Open

#821 opened on Feb 27, 2024

View on GitHub
 (3 comments) (1 reaction) (0 assignees)TypeScript (471 forks)batch import
buggood first issuehelp wanted

Repository metrics

Stars
 (12,328 stars)
PR merge metrics
 (Avg merge 3d 5h) (11 merged PRs in 30d)

Description

The following code is considered as valid by Typescript, although I was expecting it to complain that the filter foo in commonArguments was empty.

import type { NonEmptyObject } from "type-fest"

interface CommonArguments {
  [filter: string]: NonEmptyObject<{ [argument: string]: string | number | undefined }>
}

export const commonArguments: CommonArguments = {
  foo: {}
}

Contributor guide