From 024925861b9edba81d04a22d4e868141d6fe09fe Mon Sep 17 00:00:00 2001 From: muqiuhan Date: Tue, 23 Jul 2024 08:19:33 +0000 Subject: deploy: 1399be3189a368da6244e362ddbd656a62f8280a --- search.xml | 137 +++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 97 insertions(+), 40 deletions(-) (limited to 'search.xml') diff --git a/search.xml b/search.xml index c5d49945..a31d3894 100644 --- a/search.xml +++ b/search.xml @@ -554,9 +554,66 @@ - - /2024/07/23/OCaml-News-2024-5/ - + OCaml News 2024-3 + /2024/06/27/OCaml-News-2024-5/ + 语言的发展 +

新消息

+

有价值的文章

+

有趣的项目

+]]>
+ + Technique + OCaml +
Radiographic Absence of the Left Humeral Head @@ -579,6 +636,34 @@ Medicine + + Rescript @genType import 问题 + /2024/05/20/Rescript-genType-import-%E9%97%AE%E9%A2%98/ + Rescript 11 之后,@genType 被合并进编译器,无需任何依赖就能使用,当在 Rescript 中 @genType 了使用某些 Rescript built-in 的基本类型时,可能会生成有问题的 import 相关代码,例如:

+
@genType
module LoginResponse = {
let status = response => {
response
->Js.Json.decodeObject
->Option.flatMap(response => {
response->Js_dict.get("status")
})
}
}
+ +

status 函数具有 Js.Json.t => option<Js.Json.t> 类型,那么在生成的 TypeScript 文件中,会出现这样的 import:

+
import type { Json_t as Js_Json_t } from "./Js.gen.tsx"
+ +

而 Js.gen.tsx 这个文件是不存在的,解决方案是使用 @genType 的 shim:

+
    +
  • 在 rescript.json 中的 gentypeconfig 中添加 shim 配置:

    +
    ...
    "gentypeconfig": {
    ...
    "shims": {
    "Js": "Js"
    },
    ...
    }
    ...
    +
  • +
  • 然后新建 Js.shim.ts:

    +
    export type Json_t = unknown;

    export type t = unknown;

    export type Exn_t = Error;
    +
  • +
  • 删除原来由 @genType 生成的 TypeScript 文件并重新生成

    +
  • +
+

现在生成的 TypeScript 文件将会从 Js.shim.ts import 类型:

+
import type {Json_t as Js_Json_t} from '../../src/model/Js.shim.ts';
+]]>
+ + Technique + Rescript + +
Rescript and React Native /2024/01/22/Rescript-React-Native/ @@ -604,34 +689,6 @@ -]]> - - Technique - Rescript - - - - Rescript @genType import 问题 - /2024/05/20/Rescript-genType-import-%E9%97%AE%E9%A2%98/ - Rescript 11 之后,@genType 被合并进编译器,无需任何依赖就能使用,当在 Rescript 中 @genType 了使用某些 Rescript built-in 的基本类型时,可能会生成有问题的 import 相关代码,例如:

-
@genType
module LoginResponse = {
let status = response => {
response
->Js.Json.decodeObject
->Option.flatMap(response => {
response->Js_dict.get("status")
})
}
}
- -

status 函数具有 Js.Json.t => option<Js.Json.t> 类型,那么在生成的 TypeScript 文件中,会出现这样的 import:

-
import type { Json_t as Js_Json_t } from "./Js.gen.tsx"
- -

而 Js.gen.tsx 这个文件是不存在的,解决方案是使用 @genType 的 shim:

-
    -
  • 在 rescript.json 中的 gentypeconfig 中添加 shim 配置:

    -
    ...
    "gentypeconfig": {
    ...
    "shims": {
    "Js": "Js"
    },
    ...
    }
    ...
    -
  • -
  • 然后新建 Js.shim.ts:

    -
    export type Json_t = unknown;

    export type t = unknown;

    export type Exn_t = Error;
    -
  • -
  • 删除原来由 @genType 生成的 TypeScript 文件并重新生成

    -
  • -
-

现在生成的 TypeScript 文件将会从 Js.shim.ts import 类型:

-
import type {Json_t as Js_Json_t} from '../../src/model/Js.shim.ts';
]]>
Technique @@ -1315,6 +1372,15 @@ /2023/02/24/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E4%BA%8C%E6%9C%88%E4%BA%8C%E5%8D%81%E5%9B%9B%E6%97%A5/ 黑色的袋子里装满了药,这种袋子我都是用来装垃圾的,它被昏昏欲睡的老人家抱在怀里,里面的药丸随着颠簸的车厢敲打罐子,老人家醒了,她的眼睛比袋子还浑浊。

她看着我说到站了,我拉着她的手下车,该回家了,等下还要去买支圆珠笔,中性笔没法在药盒子上写用法用量。

+]]>
+ + gallery + +
+ + 二零二三年二月二日 + /2023/02/02/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E4%BA%8C%E6%9C%88%E4%BA%8C%E6%97%A5/ + 我不知道这些黑乎乎的东西从哪来的,它们填满了这黄铜色的硬币每一处,像机油,像泥泞,它们随着这五角钱硬币一起从我手上换走了一袋糖果,那是一个蓬头垢面,满身泥灰的小孩,他起身看着这个给他糖果的叔叔,我蹲下看着我拥有糖果的童年。
​
​这事很恐怖,意味着我在这个地方又多了一丝牵挂,多了一个不离开的理由。

]]>
gallery @@ -1333,15 +1399,6 @@

“欢迎醒来,乐乐”

我抖了抖身上的花瓣,还未说话,就听见了爸爸兴奋的欢呼声。爷爷奶奶眼睛一亮,立刻跑了过来,春天的风似乎都柔软了,我摊了摊手,将他们卷到自己怀里。

春暖花开,一切都在,真好。

-]]> - - gallery - -
- - 二零二三年二月二日 - /2023/02/02/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%B8%89%E5%B9%B4%E4%BA%8C%E6%9C%88%E4%BA%8C%E6%97%A5/ - 我不知道这些黑乎乎的东西从哪来的,它们填满了这黄铜色的硬币每一处,像机油,像泥泞,它们随着这五角钱硬币一起从我手上换走了一袋糖果,那是一个蓬头垢面,满身泥灰的小孩,他起身看着这个给他糖果的叔叔,我蹲下看着我拥有糖果的童年。
​
​这事很恐怖,意味着我在这个地方又多了一丝牵挂,多了一个不离开的理由。

]]>
gallery -- cgit v1.2.3