Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Missing type for exn #634

Closed
sgrove opened this issue Aug 17, 2023 · 1 comment
Closed

Missing type for exn #634

sgrove opened this issue Aug 17, 2023 · 1 comment

Comments

@sgrove
Copy link
Collaborator

sgrove commented Aug 17, 2023

Exporting a function like:

@genType
let basicEvalNode = (
  ~onError: exn => unit,
) => {

Outputs the following TypeScript:

export const basicEvalNode: (_1: {
  readonly onError: (_1: exn) => void;

But exn is never defined/imported, so we get an error:

src/HyperEval.gen.tsx:38:17 - error TS2304: Cannot find name 'exn'.
38   onError: (_1: exn) => void,

It'd be nice to even export it as unknown, since that would allow TypeSCript to continue

@sgrove
Copy link
Collaborator Author

sgrove commented Aug 17, 2023

One small hack I've found is to make a type alias but mark it opaque and use that instead, e.g.:

@genType.opaque
type userExn = exn

Obviously not ideal from the Javascript/Typescript side of things, but it means TypeScript can at least compile and doesn't block things for a bit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant