Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ‘const’ keyword is extraneous in the ParseKeys type definition. #2168

Closed
aimidy opened this issue Apr 9, 2024 · 2 comments · Fixed by #2169
Closed

The ‘const’ keyword is extraneous in the ParseKeys type definition. #2168

aimidy opened this issue Apr 9, 2024 · 2 comments · Fixed by #2169
Assignees

Comments

@aimidy
Copy link

aimidy commented Apr 9, 2024

🐛 Bug Report

'const' modifier can only appear on a type parameter of a function, method or class

const Context extends TOpt['context'] = TOpt['context'],

To Reproduce

node_modules\i18next\typescript\t.d.ts

export type ParseKeys<
  Ns extends Namespace = DefaultNamespace,
  TOpt extends TOptions = {},
  KPrefix = undefined,
  Keys extends $Dictionary = KeysByTOptions<TOpt>,
  ActualNS extends Namespace = NsByTOptions<Ns, TOpt>,
  const Context extends TOpt['context'] = TOpt['context'],
> = $IsResourcesDefined extends true
  ? FilterKeysByContext<
      | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
      | ParseKeysByNamespaces<ActualNS, Keys>
      | ParseKeysByFallbackNs<Keys>,
      Context
    >
  : string;

Expected behavior

export type ParseKeys<
  Ns extends Namespace = DefaultNamespace,
  TOpt extends TOptions = {},
  KPrefix = undefined,
  Keys extends $Dictionary = KeysByTOptions<TOpt>,
  ActualNS extends Namespace = NsByTOptions<Ns, TOpt>,
  Context extends TOpt['context'] = TOpt['context'],
> = $IsResourcesDefined extends true
  ? FilterKeysByContext<
      | ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
      | ParseKeysByNamespaces<ActualNS, Keys>
      | ParseKeysByFallbackNs<Keys>,
      Context
    >
  : string;

Your Environment

  • runtime version: i.e. node v20
  • i18next version: i.e. 23.11.0
  • os: Windows
@ing-chiba
Copy link

same here

@marcalexiei
Copy link
Member

I'll take a look at this issue later.

I think that the issue is present when compilerOptions.skipLibCheck is false.
Right it is set to true, so that's why test haven't catch it:

"skipLibCheck": true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants