GitHub - LearningTypeScript/projects: Hands-on real world projects that will help you exercise your knowledge of TypeScript.
Hands-on real world projects that will help you exercise your knowledge of TypeScript. - GitHub - LearningTypeScript/projects: Hands-on real world projects that will help you exercise your knowledg...
github.com
다음으로, 저는 당신이 해결해야 할 반대 유형의 과제를 가지고 있습니다.
저는 당신을 위해 'Case' 타입을 만들었고 'cases' 배열을 가지고 있습니다.
그러나 cases의 요소들은 형식이 다양하고 Case의 타입과 항상 일치하는 것은 아닙니다.
Case 타입을 변경하지 않고 cases를 수정하십시오.
## 파일
- "index.ts": 객체 타입 및 타입 어노테이션 작성
- "index.test.ts": 테스트
- "solution.ts": 솔루션 코드
export type Case = {
court: "state" | "federal";
decided: Date;
defendant: string;
id: string | string[];
plaintiff: string;
title: string;
};
export const cases: Case[] = [
{
court: "federal",
decided: new Date("February 18, 1986"),
defendant: "Glynn Batson and Southplains Land Corporation",
id: "841710",
plaintiff: "United States of America",
title: "United States v. Batson",
},
{
court: "state",
decided: new Date("April 17, 1992"),
defendant: "Bradford Marine, Inc",
id: ["90-6372-CIV", "90-6599-CIV"],
plaintiff: "Lyn C. Noble",
title: "Noble v. Bradford Marine, Inc",
},
{
court: "state",
defendant: "PepsiCo, Inc.",
decided: new Date("August 5, 1999"),
id: ["96-cv-5320", "96-cv-9069"],
plaintiff: "John Leonard",
title: "Leonard v. Pepsico, Inc.",
},
];
타입에 맞게 값을 수정하는 문제
728x90
'Typescript > 러닝 타입스크립트 연습문제' 카테고리의 다른 글
(5장) Secret Secrets - 1.Incoming Cipher (0) | 2023.04.13 |
---|---|
(4장) Various Lawyerings - 3.Making Arguments (0) | 2023.04.12 |
(4장) Various Lawyerings - 1.Aviary Classification (0) | 2023.04.12 |
(3장 심화) The Narrow Trail (0) | 2023.04.06 |
(3장) Primitive Cooking - 3. Seating (0) | 2023.04.06 |