Skip to content

Can't use genType #128

Closed
Closed
@jmagaram

Description

@jmagaram

GenType generates import statements for Core modules that don't work. What do I need to do to make this work?

I see in https://rescript-lang.org/docs/gentype/latest/usage#dependent-projects--libraries it says "The library must have been published with the .gen.ts files created by genType."

I've got a file ReactFirebaseHooks.res with this in it AND my bsconfig.json has "bsc-flags": ["-open RescriptCore"]

@gentype.import("react-firebase-hooks/auth") @genType.as("useAuthState")
external useAuthState: Auth.t => (Null.t<Auth.user>, bool, option<Error.t>) =
  "useAuthState"

This leads to the following in my ReactFirebaseHooks.gen.tsx...

import type {t as Error_t} from './Error.gen'; // does not exist
import type {t as Null_t} from './Null.gen'; // does not exist

If I change the code to reference Core__Error.gen this is probably closer to the desired result, but still doesn't work.

import type {t as Core__Error_t} from '@rescript/core/src/Core__Error.gen'; // does not exist
import type {t as Core__Null_t} from '@rescript/core/src/Core__Null.gen'; // does not exist

I tried taking out the -open RescriptCore but it still doesn't work. I tried adding node_modules/~rescript/core/src to bsconfig.json but this shouldn't be necessary and still doesn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions