microsoft / microsoft/TypeScript
Add the possibility to import Types from global loaded Librarys
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔍 Search Terms
import types global
✅ Viability Checklist
- 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, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
In browser environemnt you often need to load librarys, wich are developed as ESM modules ans with ESM types globaly, cause they are only delivered as CJS, for example typescript, see: https://github.com/microsoft/TypeScript/issues/57010
There should be a way, so I can import typescript and use it, without loading the library (like import type), but there should be no error if I use instances from the import.
for example at the moment it is like this:
import type ts form 'typescript'
const a = ts.SyntaxKind.TaggedTemplateExpression
will error cause the import is only imported as type
maybe something like this:
import global type ts form 'typescript'
const a = ts.SyntaxKind.TaggedTemplateExpression
or
import global ts form 'typescript'
const a = ts.SyntaxKind.TaggedTemplateExpression
would be possible?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Durchsicht der vorgeschlagenen Beispiele für import type und des zugehörigen TypeScript-Issues 57010, um das Szenario mit globalen Bibliotheken und das gewünschte Laufzeitverhalten zu verstehen. Definieren Sie die unterstützte Syntax und Semantik für den Zugriff auf Werte wie ts.SyntaxKind.TaggedTemplateExpression, ohne die Bibliothek zu laden; das Issue ist abgeschlossen, wenn das Design spezifiziert und anhand der genannten Einschränkungen validiert wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 28/100