-
Notifications
You must be signed in to change notification settings - Fork 69
Typescript backend spec #1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Typescript backend spec #1247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR provides a comprehensive specification for the TypeScript backend, establishing detailed guidelines for translating Elm types and constructs to TypeScript. The changes expand the documentation to include complete type mapping specifications and rename sections for better clarity.
- Restructures documentation with clearer section headings (Type Definitions vs Types, etc.)
- Adds comprehensive type expression mappings for variables, references, tuples, records, functions, and intrinsic types
- Provides detailed mapping table for Morphir SDK types to TypeScript equivalents
| return { name, age } | ||
| } | ||
| // an additional function matching the name of the type | ||
| function Foo(a: string, b: number): Foo = {a, b} |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This TypeScript function syntax is incorrect. It should use arrow function syntax => {a, b} or traditional function syntax with return {a, b}.
| function Foo(a: string, b: number): Foo = {a, b} | |
| function Foo(a: string, b: number): Foo { | |
| return { a, b }; | |
| } |
| ### Extensible records | ||
| Extensible records are records that specify known fields with the ability of have other undeclared fields in them. | ||
| The most appropraite translation of an extensible record is an intersection of record types, and this is how we map them. |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'appropraite' should be 'appropriate'.
| The most appropraite translation of an extensible record is an intersection of record types, and this is how we map them. | |
| The most appropriate translation of an extensible record is an intersection of record types, and this is how we map them. |
| ``` | ||
| Basic types should be mapped to their corresponding types in typescript | ||
| ### Instrinsic Types |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'Instrinsic' should be 'Intrinsic'.
| ### Instrinsic Types | |
| ### Intrinsic Types |
| can be conveniently translated to | ||
| ```typescript | ||
| type alias Foo<A> = ... |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript doesn't use the 'alias' keyword for type definitions. This should be 'type Foo = ...'.
| type alias Foo<A> = ... | |
| type Foo<A> = ... |
Terms