Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript @genType只生成了一个类型_Typescript_Reason_Bucklescript - Fatal编程技术网

Typescript @genType只生成了一个类型

Typescript @genType只生成了一个类型,typescript,reason,bucklescript,Typescript,Reason,Bucklescript,在向React原生typeScript代码库添加ReasonML之后,我发现@genType只生成了一个类型,即使BuckleScript成功地传输了这两个函数。如何解决这个问题 reasonSum.re [@genType] let reasonSum = (a, b) => a + b; let reasonSum2 = (a, b) => a + b; reasonSum.gen.tsx /* TypeScript file generated from reasonSum.

在向React原生typeScript代码库添加ReasonML之后,我发现@genType只生成了一个类型,即使BuckleScript成功地传输了这两个函数。如何解决这个问题

reasonSum.re

[@genType]
let reasonSum = (a, b) => a + b;
let reasonSum2 = (a, b) => a + b;
reasonSum.gen.tsx

/* TypeScript file generated from reasonSum.re by genType. */
/* eslint-disable import/first */

// tslint:disable-next-line:no-var-requires
const Curry = require('bs-platform/lib/es6/curry.js');

// tslint:disable-next-line:no-var-requires
const reasonSumBS = require('./reasonSum.bs');

export const reasonSum: (a:number, b:number) => number = function (Arg1: any, Arg2: any) {
  const result = Curry._2(reasonSumBS.reasonSum, Arg1, Arg2);
  return result
};
bsconfig.json

{
  "name": "reason-in-react-typescript",
  "sources": [
    {
      "dir": "./reason",
      "subdirs": true
    }
  ],
  "package-specs": [
    {
      "module": "es6-global",
      "in-source": true
    }
  ],
  "bs-dependencies": [
    "@glennsl/bs-json",
    "bs-fetch"
  ],
  "suffix": ".bs.js",
  "namespace": true,
  "refmt": 3,
  "gentypeconfig": {
    "language": "typescript",
    "module": "es6",
    "importPath": "relative",
    "shims": {
      "Js": "Js",
      "React": "ReactShim",
      "ReactEvent": "ReactEvent",
      "ReasonPervasives": "ReasonPervasives",
      "ReasonReact": "ReactShim"
    },
    "debug": {
      "all": false
    },
    "exportInterfaces": false
  }
}

通常,附加到单个项的属性都仅适用于该项。通过不将属性与特定项相关联(可能会被解释为与它所包含的模块相关联),可以使属性独立,但我认为
genType
不支持这一点。相反,您似乎必须为要导出的每个项目添加一个属性:

[@genType]
let reasonSum = (a, b) => a + b;
[@genType]
let reasonSum2 = (a, b) => a + b;