/* Intro: Project grew and we ended up in a situation with some users starting to have more influence. Therefore, we decided to create a new person type called PowerUser which is supposed to combine everything User and Admin have. Exercise: Define type PowerUser which should have all fields from both User and Admin (except for type), and also have type 'powerUser' without duplicating all the fields in the code. */
// In case you are stuck: // https://www.typescriptlang.org/docs/handbook/utility-types.html // https://www.typescriptlang.org/docs/handbook/2/objects.html#intersection-types
报错:
1 2 3 4 5 6 7 8 9 10
index.ts(53,12): error TS2571: Object is of type'unknown'. index.ts(57,12): error TS2571: Object is of type'unknown'. index.ts(61,12): error TS2571: Object is of type'unknown'. index.ts(73,36): error TS2571: Object is of type'unknown'. index.ts(73,52): error TS2571: Object is of type'unknown'. index.ts(75,20): error TS2571: Object is of type'unknown'. index.ts(75,36): error TS2571: Object is of type'unknown'. test.ts(5,5): error TS2344: Type 'false' does not satisfy the constraint 'true'. test.ts(16,5): error TS2344: Type 'false' does not satisfy the constraint 'true'. test.ts(27,5): error TS2344: Type 'false' does not satisfy the constraint 'true'.
/* Intro: Project grew and we ended up in a situation with some users starting to have more influence. Therefore, we decided to create a new person type called PowerUser which is supposed to combine everything User and Admin have. Exercise: Define type PowerUser which should have all fields from both User and Admin (except for type), and also have type 'powerUser' without duplicating all the fields in the code. */
// In case you are stuck: // https://www.typescriptlang.org/docs/handbook/utility-types.html // https://www.typescriptlang.org/docs/handbook/2/objects.html#intersection-types