microsoft / microsoft/TypeScript

Imperative type definition

Aperta
#62,145 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

### 🔍 Search Terms

imperative typescript interface

### ✅ Viability Checklist

- [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [x] This wouldn't change the runtime behavior of existing JavaScript code
- [x] This could be implemented without emitting different JS based on the types of the expressions
- [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

### ⭐ Suggestion

I work on a library that requires to use lots of 3rd party generic types, multiple mappings and more or less complex typing, and I've got to repeat one complex type multiple times or create another generic that is going to contain a lot of parameters and will complicate the code that's already complicated.

(these types have bugs, they just an illustration)
Image

### 📃 Motivating Example

I imagine it as an "type function" that has function body that returns any valid type.

```ts
imperative type Foo {
type X = Bar;
type Y = Baz;

return { x: X, y: Y };
}

type Quix = Foo;
// Quix { x: Bar, y: Baz }

// ... vs
interface Foo {
x: Bar;
y: Baz;
}
```

### 💻 Use Cases

- Imperative style
- Shorter syntax for complex types

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.

Direzione di ricerca

Non sono identificati file di implementazione, punto di ingresso o test. Inizia esaminando la sintassi proposta e gli esempi motivanti rispetto agli obiettivi di progettazione di TypeScript, quindi analizza l’architettura del verificatore dei tipi per determinare dove potrebbe inserirsi una funzionalità a livello di tipo; il lavoro sarà considerato completato quando saranno disponibili un design concordato e la relativa implementazione e i test.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.