Conversation
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Spelling error: 'Instrinsic' should be 'Intrinsic'.
| ### Instrinsic Types | |
| ### Intrinsic Types |
| can be conveniently translated to | ||
|
|
||
| ```typescript | ||
| type alias Foo<A> = ... |
There was a problem hiding this comment.
TypeScript doesn't use the 'alias' keyword for type definitions. This should be 'type Foo = ...'.
| type alias Foo<A> = ... | |
| type Foo<A> = ... |
Terms