Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[node-core-library] Replace static classes with exported module namespace objects

Aperta
#5,434 0 commenti 1 reazione 1 assegnatario Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Summary

While preserving the implementations and outward-facing API shape (All consumers of the refactored APIs should not need any code changes to compile and test successfully), replace static classes like:

./FileSystem.ts
export class FileSystem {
  public static someApi(...): TResult { ... }
}

with a reexported module namespace object that forwards individual exports for single files:

./FileSystem.ts
import * as FileSystem from './fileSystem/index';
./fileSystem/index.ts
export { someApi } from './someApi';
./fileSystem/someApi.ts
export function someApi(...): TResult { ... }

The Disposables and Objects APIs are existing examples of the new pattern. FileSystem and Text are examples of the old pattern to be replaced.

The reason for this conversion is that module namespace objects can be tree-shaken by modern bundlers, but static members on classes cannot.

Lingua principale
TypeScript
Stelle
6.5k
Fork
708
Merge medio
4g 13h
PR unite (30g)
62

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Altre issue di microsoft/rushstack

Tutte le issue di microsoft/rushstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.