microsoft / microsoft/TypeScript

Import star should work with export type

Aperta
#38,306 0 commenti 10 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

import star export type

Suggestion

See the code below.

Use Cases

See the code below.

Examples

// a.ts
const a = 1
export type { a } // expected to be used as type only, user case: sharing type rather than value between source code between nodejs and browser

const b = 1
export type { b }

// export other types

// c.ts
import * as c from './a' // to avoid: import { a as a1, b as b1 } from './a'

declare const a: typeof c.a
declare const b: typeof c.b

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.

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 indicati file sorgente, test o punti di ingresso del compilatore. Inizia riproducendo l'esempio con a.ts e c.ts usando il compilatore TypeScript e verifica come vengono gestite le dichiarazioni export type e gli import di namespace con asterisco. Il lavoro è completato quando le esportazioni di soli tipi sono disponibili tramite il namespace dell'import con asterisco senza modificare il JavaScript emesso.

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
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.