Skip to content

Required shim for "PervasivesU", gentype #6807

Closed
@jmagaram

Description

@jmagaram

I created a new empty ReScript project with the latest stuff and a small "Hello World" React component seems to work. BUT there is an error in the VS Code reporting. The generated .gen.tsx files has this code...

import * as HelloJS from './Hello.res.js';
import type {Jsx_element as PervasivesU_Jsx_element} from './PervasivesU.gen.tsx';
export type props = {};
export const make: (_1:props) => PervasivesU_Jsx_element = HelloJS.make as any;

The error is...

Cannot find module './PervasivesU.gen.tsx' or its corresponding type declarations.

I had no idea how to fix this. Using...

    "@rescript/core": "^1.3.0",
    "@rescript/react": "^0.12.2",
    "rescript": "^11.1.1"

This separate bug in the compiler has a repro scenario where the developer fixed this problem I ran into by creating a shim.

#6624
https://github.com/WhyThat/gentype-error-reproduction/blob/main/src/shims/PervasivesU.shim.ts

I think that (1) the shim should not be required, or (2) the documentation for getting started with ReScript and React needs to explain how to make the shim. Actually now I see that TypeScript shims have been deprecated so I'm confused how I'm supposed to handle this issue.

My rescript.json file...

{
  "name": "hotkey",
  "sources": [
    {
      "dir": "src",
      "subdirs": true
    }
  ],
  "package-specs": [
    {
      "module": "esmodule",
      "in-source": true
    }
  ],
  "suffix": ".res.js",
  "bs-dependencies": ["@rescript/core", "@rescript/react"],
  "bsc-flags": ["-open RescriptCore"],
  "jsx": { "version": 4 },
  "gentypeconfig": {
    "module": "esmodule",
    "moduleResolution": "bundler",
    "generatedFileExtension": ".gen.tsx"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions