-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Roadmap: Dartify Beta — Stabilization, JS Interop Migration & Runtime Validation
This issue tracks the tasks, bugs, and enhancements required to reach the first stable Beta release of dartify, the .d.ts to Dart js_interop code generator.
Goals
- Ensure type-safe, runtime-usable Dart bindings for major
.d.tsfiles - Migrate fully to
dart:js_interopmodern model - Verify real-world integration with libraries like H3, Leaflet, Axios
Core Tasks
Type System & Parser
- Revamp
typeResolverto return a fully structured IR (e.g., withtypeRef,get/set,modifiers, etc) - Fix unions with
T | undefined | nullorT | nullresults inTnotT? - Handle intersection types properly (
A & B) - Fix type alias mapping (ensure
typekeyword is correctly tracked) - Handle Generics Properly
- Implement a proper type registry and use it
- Fix type issue where Index Signature.index type results as Object object. for example:
[key: string]: intas[key: Object object]: double - Properly Parse Complex and Named tuple types
- Parse Modifiers and return them, related to first one
- Use ts.Node rather than ts.Type for parse to get more information to resolve type to string(ParsedType Interface, check first one)
- Inbuilt Interface in js/ts are not resolved and returns just their Identifier name. for example Promise & Array
- Emit new JSx types from js_interop. for example: JSAny, JSObject, JSString, etc.
Code Generation
- Add
@JS(...)annotations everywhere needed (with correct prefixes) - Escape Dart keywords (e.g.,
default,factory,new, etc.) - Convert function/constructor overloads into uniquely named external factory/methods by using a map<string, parsedFuncion[]>
- Implement callable interfaces (deferred)
- Correctly emit optional parameters and variadic/rest parameters (?, ...)
- Proper
operator []/[]=support for index signatures - Implement Interfaces with raw quoted properties as Index Signatures and then add proper get/set accessors
- If enums dont explicitly mention the value like v1 = 0, then the result type is just the identifier not num/double
- Hook dom/es types, classes and functions using package: web and js_interop
- Treat ObjectLiteral Types as Classes and emit get/set acessors instead of simple
Map<String, dynamic> - Emit JSDoc Comments to final output
- Preserve Statement/Member in module/class/interface
- Emit New js_interop code rather than old js code
Project Structure
- Split monolithic emitter into per-component files (type, class, interface, etc)
- Generate per-module files with
partandexportstructure - Add a logger + debug tracer (optional)
Testing & Validation
- Real-world test with
h3-js - Run web integration test with
leaflet - Run web integration test with
axios - Test
lib.dom.d.tsruntime output - Check output for compile-time errors (missing types, bad keywords, etc)
- Validate correct resolution of top-level
declarevars/functions
Output Formats
- Add ability to export IR for debugging
Docs & Meta
- Add README with usage guide
- Add CLI usage example
- Document annotation logic and mapping rules
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels