- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
尽管以前可以在我的代码中使用,但我无法将平面 map 与 Node 或 ts-node 一起使用。我不确定发生了什么变化,但我收到此错误 'TypeError: [x].flatMap is not a function'
flatMap() 应该是一个函数,因为我明确地将 x 设为一个数组(此代码在没有问题之前可以正常工作)。
这是我的 tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es2020",
"esModuleInterop": true,
"sourceMap": true,
"strictNullChecks": true,
"outDir": "out",
//"strictBindCallApply": true,
//"strict": true
}
}
这是我的兰彻
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/main.ts",
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "npm: build",
"runtimeArgs": ["-r", "esm"],
"stopOnEntry": true,
"console": "integratedTerminal",
},
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"--require",
"esm",
"--require",
"ts-node/register",
"--project",
"${workspaceFolder}/tsconfig.json",
"${workspaceFolder}/**/*spec.ts"
],
"console": "integratedTerminal",
"stopOnEntry": false,
}
]
}
以及有问题的平面 map 调用
(x: discord.Message | discord.Message[] | null): (discord.Message | null)[] => [x].flatMap(
// @ts-ignore
(t: discord.Message | discord.Message[] | null): (discord.Message | discord.Message[] | null) => t
)
另一个不起作用的例子:
const test = [1,3,4,[5,4,2]].flatMap(x => x);
类型错误:[1,3,4,[5,4,2]].flatMap 不是函数
ts-node/register 或 ts-node 似乎都不再尊重 "target": "es2020"
了,我不确定到底发生了什么变化。 VScode 确实有 flatMap 的智能感知上下文。谁能向我解释一下为什么它不再起作用了?
最佳答案
问题是我在安装程序后遇到了 Node 版本号冲突。我已经停止使用node的snap包,开始使用nvm了。
关于node.js - 无法获取 Node 或 ts-node/register 来再使用 es2020(flatMap 不是函数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58758731/
我有本地更改和远程更改。 有人告诉我必须先推,再 pull 。这背后有什么原因吗? 最佳答案 那个人错了:正确的模型是pull-before-you-push,而不是相反。 当您pull时,git 将
我正在使用最新版本的 Flat UI Pro 1.3.2 ( http://designmodo.com/flat/ ),jQuery 插件 flatui-radiocheck v0.1.0 和 iO
我是一名优秀的程序员,十分优秀!