@genType 只生成了一个类型
Only a single type was generated by @genType
将 ReasonML 添加到 React-Native typeScript 代码库后,我发现 @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;
将 ReasonML 添加到 React-Native typeScript 代码库后,我发现 @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;