rescript-association / genType

Auto generation of idiomatic bindings between Reason and JavaScript: either vanilla or typed with TypeScript/FlowType.

Home Page:https://rescript-lang.org/docs/gentype/latest/introduction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not generate accessors

OctoD opened this issue · comments

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

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

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