rescript-association / genType

Auto generation of idiomatic bindings between Reason and JavaScript: either vanilla or typed with TypeScript/FlowType.
https://rescript-lang.org/docs/gentype/latest/introduction
MIT License
757 stars 44 forks source link

Does not generate accessors #566

Closed OctoD closed 12 months ago

OctoD commented 3 years ago

Given the snippet

@deriving(accessors)
@genType
type rec t = {
  id: string,
  name: string,
  description: string,
  related: array<t>,
  updated: option<string>,
}

I'd assume that genType would create both interface for t and type defs for accessors functions, but it generates only

/* TypeScript file generated from Interest.res by genType. */
/* eslint-disable import/first */

// tslint:disable-next-line:interface-over-type-literal
export type t = {
  readonly id: string; 
  readonly name: string; 
  readonly description: string; 
  readonly related: t[]; 
  readonly updated?: string
};

This could be misleading while creating and sharing a library, or even while handling interop between Rescript and TypeScript in a single codebase

cristianoc commented 3 years ago

genType does not have any special support for @deriving(accessors)

ryyppy commented 12 months ago

This repository is being archived. If you feel like the issue still relevant, please re-create it in the compiler repo. Thanks!