genType icon indicating copy to clipboard operation
genType copied to clipboard

Does not generate accessors

Open OctoD opened this issue 2 years ago • 1 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

OctoD avatar Jul 27 '21 15:07 OctoD

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

cristianoc avatar Jul 27 '21 16:07 cristianoc

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

ryyppy avatar Nov 13 '23 13:11 ryyppy