我正在研究 Typescript 并遇到问题。我想使用import和 顶级await,但目前我一次只能使用一个。
这是我的配置,tsconfig.json允许我使用导入
"target": "ESNext",
"module": "ESNext"
Run Code Online (Sandbox Code Playgroud)
这个允许我使用顶级等待:
"module":"commonjs"
Run Code Online (Sandbox Code Playgroud)
我添加了
"type":"module"
Run Code Online (Sandbox Code Playgroud)
给我的package.json
有什么方法可以同时利用这两个功能吗?非常感谢。
我正在使用 Nodejs 16 和 Typescript 4.5.5
我正在尝试使用Constraint Layout.在Gradle构建成功完成.但我得到了"安装APK时出错",代码如下:
无法完成会话:INSTALL_FAILED_INVALID_APK:已多次定义拆分lib_slice_0_apk
这是我的布局代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/app_bar_main">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="B?n c?m th?y th? nào" />
<Button
android:id="@+id/checkSicknessBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Ki?m tra"
android:textColor="@android:color/holo_blue_light"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#9ed7ec"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/content_margin"
android:src="@drawable/baseline_access_alarm_white_48" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Gi? u?ng thu?c s?p t?i 15:30"
android:textAlignment="center"
android:textColor="#f29d15"
android:textSize="20dp" …Run Code Online (Sandbox Code Playgroud) android android-layout android-studio android-constraintlayout
我正在尝试使用 Nodejs 中的 date-fns 解析 utc 时间到时区
const date = new Date('2018-09-01T16:01:36.386Z');
const timeZone = 'Europe/Berlin';
const zonedDate = utcToZonedTime(date, timeZone);
// zonedDate could be used to initialize a date picker or display the formatted local date/time
// Set the output to "1.9.2018 18:01:36.386 GMT+02:00 (CEST)"
const pattern = "d.M.yyyy HH:mm:ss.SSS 'GMT' XXX (z)";
const output = format(zonedDate, pattern, { timeZone: 'Europe/Berlin' });
console.log(output);
Run Code Online (Sandbox Code Playgroud)
我正在使用文档中的这段代码来检查我的问题,但它没有按照文档所述打印。这是输出:
2018 年 9 月 1 日 18:01:36.386 GMT Z (GMT+0)
我不知道为什么时间部分发生了变化,但时区仍然是 UTC。它应该是:
2018 年 9 …
我正在尝试将此 SQL 实现到我的 Sequelize
SELECT file_id FROM table WHERE datediff(curdate(),create_date) > 5;
Here is my Sequelize
findOverPeriodFile: function () {
return table.findAll({
where:{
60: {lt: Sequelize.fn('')}
}
});
}
Run Code Online (Sandbox Code Playgroud)
我是 Seuelize 的新手,我曾尝试在 Google 上进行搜索,但无济于事。有人对这个问题有答案吗?我不知道在WHERE声明中写什么。对不起,我的英语不好。
我正在尝试运行这个 sql,如果不存在,它会创建一个新类型:
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'ai') CREATE TYPE ai AS (a text, i int);
Run Code Online (Sandbox Code Playgroud)
我在“if”处或附近遇到错误,我试图找出答案,但没有帮助。我也试过这个,但它仍然不起作用:
CASE (SELECT 1 FROM pg_type WHERE typname = 'ai') WHEN IS NULL THEN CREATE TYPE ai AS (a text, i int);
Run Code Online (Sandbox Code Playgroud)
“CASE”附近或“CASE”处的错误
node.js ×3
android ×1
date-fns ×1
javascript ×1
postgresql ×1
sequelize.js ×1
timezone ×1
typescript ×1