TS2713
Cannot access 'CheckSuite.status' because 'CheckSuite' is a type, but not a namespace. Did you mean to retrieve the type of the property 'status' in 'CheckSuite' with 'CheckSuite["status"]'?
Broken Code ❌
type CheckSuite = {
passed: boolean
status: 'ok' | 'error'
}
type ServerResponse = {
status: CheckSuite.status
}Fixed Code ✔️
The utility type Pick comes in handy when you want to select and extract specific properties from one type and apply them to another type:
type CheckSuite = {
passed: boolean
status: 'ok' | 'error'
}
type ServerResponse = {
status: Pick<CheckSuite, 'status'>
}