Refactor to extract a part of type property into a new type

Aperta
#41,298 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
typescript

Direzione di ricerca

Non vengono indicati file sorgente, test o punti di ingresso. Inizia esaminando la trasformazione richiesta dell’interfaccia TypeScript e le capacità di refactoring esistenti; il lavoro sarebbe completato definendo un workflow di estrazione automatica che produca la nuova struttura di tipi e proprietà illustrata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Awaiting More Feedback Suggestion

Search Terms

refactor, extract, types, property

Suggestion

It's common to convert a part of properties into new type when we got too many related property.

Could we provide an automatic way to do this?

Examples

//from
interface A {
    /*a*/f1: string
    f2: string/*b*/

    a1: number
}
// to
interface NewType {
    f1: string
    f2: string
}

interface A {
    /*RENAME*/ newProperty: NewType

    a1: number
}


Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 15h
PR unite (30g)
106

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.

Altre issue di microsoft/TypeScript

Tutte le issue di microsoft/TypeScript

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.