Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: using is a keyword in Typescript 5.2 now!??? #1228

Closed
CyanChanges opened this issue Oct 15, 2023 · 3 comments
Closed

Bug: using is a keyword in Typescript 5.2 now!??? #1228

CyanChanges opened this issue Oct 15, 2023 · 3 comments
Labels
bug BUG

Comments

@CyanChanges
Copy link

CyanChanges commented Oct 15, 2023

Describe the bug

插件可以使用 using 属性标注服务依赖 (https://koishi.chat/zh-CN/guide/plugin/service.html#using-属性)
但是在 TS 5.2 中是关键字
(https://www.google.com.hk/search?q=typescript+using)

以后 JS 估计也有
https://github.com/tc39/proposal-explicit-resource-management

Steps to reproduce

创建一个 Koishi 插件
使用 using 声明服务依赖

// src/index.ts
import { Context } from 'koishi'

export const using = ['keine'] // some Syntax Error here

export function apply(ctx: Context) {
/* do something... */
}

Expected behavior

有一个方法可以声明服务依赖,不使用类插件

Screenshots

image

image

Versions

  • OS: Windows 11
  • Platform: 不适用
  • Node version: v20.8.1
  • Koishi version: 4.15.1
  • Typescript version: 5.2.2

Additional context

No response

@CyanChanges CyanChanges added the bug BUG label Oct 15, 2023
@shigma
Copy link
Member

shigma commented Oct 15, 2023

Temporary workaround:

const _using = []

export { _using as using }

@CyanChanges
Copy link
Author

CyanChanges commented Oct 20, 2023

cordis 更了可以 close 了吧(

新版将使用 inject 代替 using cordiverse/cordis@13b6cdd

// Example
export const inject = ['keine']

@shigma
Copy link
Member

shigma commented Oct 20, 2023

也行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug BUG
Projects
None yet
Development

No branches or pull requests

2 participants