Skip to content

Instantly share code, notes, and snippets.

View xwartz's full-sized avatar
🎯
Focusing

xwartz xwartz

🎯
Focusing
View GitHub Profile
@xwartz
xwartz / interview-type.ts
Created May 27, 2021 05:23
interview-type
/**
*
* Complete the following 2 types of 'CreateRequest' and 'GetParams'.
* 完善下述两个类型 'CreateRequest' 和 'GetParams'。
*
**/
// improve type of CreateRequest
type CreateRequest = unknown
@xwartz
xwartz / interview-type.ts
Last active January 28, 2022 02:31
interview-type
/**
* 给定数组,转换为对象类型,键/值必须在给定数组中。
**/
// Example:
const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const
const result: TupleToObject<typeof tuple> // expected { tesla: 'tesla', 'model 3': 'model 3', 'model X': 'model X', 'model Y': 'model Y'}