microsoft / microsoft/TypeScript

Error TS4020 or TS4023, working with mixins, base class has static symbol property, only when multiple files.

Aperta
#52,644 2 commenti 2 reazioni 1 assegnatario Vedi su GitHub

@weswigham ci sta già lavorando.

Dal 17/2/2023.

Needs Investigation Rescheduled
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Bug Report

In the following code (file: index.ts)

export class TestComponent extends MixinComponent(Component<HTMLElement>)<number> {
}

I get error TS4020: 'extends' clause of exported class 'TestComponent' has or is using private name 'Test'.

I've gotten that error before and managed to fix it by exporting the "private name" the compiler is complaining about.

But in this case, said name IS being exported (file: component.decl.ts)

export const Test = Symbol("test");  // <--- HERE

export declare abstract class Component<T extends HTMLElement = HTMLElement> {
  readonly element: T;

  public static [Test]: string;
}

What other reason is there to cause this error? I don't see no "private name".

It's also a different error Exported variable 'MixinParent' has or is using name 'Test' from external module "/sandbox/component.decl" but cannot be named. if I put the inheritance in two separate lines (file: index.ts)

export const MixinParent = MixinComponent(Component<HTMLElement>);

export class AnotherTestComponent extends MixinParent<string> {
}
🔎 Search Terms

all in title.

🕗 Version & Regression Information

latest.
(declaration: true)

⏯ Playground Link

codesandbox.io link

in playground is not reproducible, I suppose because everything is in a single file, but here's a link anyway.

Playground link

💻 Code

above.

🙁 Actual behavior

errors.

🙂 Expected behavior

no errors.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.