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

新题目 #17104

Closed
Big-Bear3 opened this issue Oct 6, 2022 · 3 comments
Closed

新题目 #17104

Big-Bear3 opened this issue Oct 6, 2022 · 3 comments
Labels
new-challenge Propose a new challenge, a PR will be auto generated zh-CN 简体中文

Comments

@Big-Bear3
Copy link

Big-Bear3 commented Oct 6, 2022

基本信息

# 题目难度
difficulty: hard

# 题目标题
title: 根据类的实例类型,推断其构造方法参数

# 题目标签
# tags: class, object

题目

给出一个类的实例类型T,实现InstanceConstructorParameters<T>,推断其构造方法参数类型。

题目模版

type InstanceConstructorParameters<T>= any

判题测试

class TestClass {
    constructor(code: number, name: string) {}
}

type Icp = InstanceConstructorParameters<TestClass>;  // expected to be [code: number, name: string]
@Big-Bear3 Big-Bear3 added new-challenge Propose a new challenge, a PR will be auto generated zh-CN 简体中文 labels Oct 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2022

Issue 格式不正确,请按照依照模版修正

@jiangshanmeta
Copy link
Member

@Big-Bear3 Do you mean the built-in ConstructorParameters type ?

@Big-Bear3
Copy link
Author

@Big-Bear3 Do you mean the built-in ConstructorParameters type ?

Nope, mine is through instance type, the ConstructorParameters type is through the class type!

@antfu antfu closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-challenge Propose a new challenge, a PR will be auto generated zh-CN 简体中文
Projects
None yet
Development

No branches or pull requests

3 participants