강의

멘토링

커뮤니티

Inflearn Community Q&A

rhkdtjd124829's profile image
rhkdtjd124829

asked

Advanced TypeScript skills learned through hands-on practice

The basics of object indexing

문제를 한번 풀어보았습니다.

Resolved

Written on

·

219

0


import { Equal, Expect } from "./helper";

export const fakeDataDefaults = {
  foo: "bar",
  bar: 123,
  baz: true,
};

type objType = typeof fakeDataDefaults;

export type FooType = objType["foo"];
export type BarType = objType["bar"];
export type BazType = objType["baz"];

type tests = [
  Expect<Equal<FooType, string>>,
  Expect<Equal<BarType, number>>,
  Expect<Equal<BazType, boolean>>
];
typescript

Answer 1

1

rhkdtjd124829님의 프로필 이미지
rhkdtjd124829
Questioner

헉 정답과 똑같군요!

rhkdtjd124829's profile image
rhkdtjd124829

asked

Ask a question