We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
type arr1 = ['a', 'b', 'c', 'd'] type arr2 = [3, 2, 1] type re1 = Pop<arr1> // expected to be ['a', 'b', 'c'] type re2 = Pop<arr2> // expected to be [3, 2]
implement pop, return an Array without it's last element
type Pop<T extends any[]> = T extends [...infer Prev, infer _] ? Prev : []
直接通过使用 infer 变量来接受元组中的参数,... 表示多个,和js中解构类似,过滤出最后一个值就行了
...
The text was updated successfully, but these errors were encountered:
No branches or pull requests
question
implement pop, return an Array without it's last element
resolve
explain
直接通过使用 infer 变量来接受元组中的参数,
...
表示多个,和js中解构类似,过滤出最后一个值就行了The text was updated successfully, but these errors were encountered: