agentsclimarketplace

Typescript

Skill DaleStudy/skills/skills/typescript

πŸ› οΈ μ—μ΄μ „νŠΈ μŠ€ν‚¬

Install
npx -y skills add DaleStudy/skills --skill typescript

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

TypeScript νƒ€μž… μ •μ˜ 및 베슀트 ν”„λž™ν‹°μŠ€ μŠ€ν‚¬. λ‹€μŒ μƒν™©μ—μ„œ μ‚¬μš©: (1) TypeScript 파일(.ts, .tsx) μž‘μ„± λ˜λŠ” μˆ˜μ • μ‹œ, (2) νƒ€μž… μ •μ˜(interface, type) μž‘μ—… μ‹œ, (3) tsconfig.json μ„€μ • λ˜λŠ” 컴파일러 μ˜΅μ…˜ μ‘°μ • μ‹œ, (4) νƒ€μž… μ—λŸ¬ ν•΄κ²° λ˜λŠ” νƒ€μž… μ•ˆμ „μ„± κ°œμ„  μ‹œ, (5) μ œλ„€λ¦­, μœ ν‹Έλ¦¬ν‹° νƒ€μž…, νƒ€μž… μ‘°μž‘ μž‘μ—… μ‹œ, (6) 'typescript', 'ts', 'type', 'interface', 'generic' ν‚€μ›Œλ“œκ°€ ν¬ν•¨λœ μž‘μ—… μ‹œ

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.8 KB, as published. Nobody here has run it

TypeScript

TypeScript ν•Έλ“œλΆ 기반 νƒ€μž… μ •μ˜ 및 베슀트 ν”„λž™ν‹°μŠ€. κΈ°λ³Έ λ¬Έλ²•Β·νƒ€μž… μ‘°μž‘Β·μœ ν‹Έλ¦¬ν‹° νƒ€μž… μƒμ„ΈλŠ” references/ 및 Handbook μ°Έκ³ .

κΈ°λ³Έ 원칙

1. νƒ€μž… μΆ”λ‘  ν™œμš©

λΆˆν•„μš”ν•œ μ–΄λ…Έν…Œμ΄μ…˜ μƒλž΅. λ³€κ²½ μ‹œ 이쀑 μˆ˜μ • λΆ€λ‹΄ κ°μ†Œ, 좔둠이 더 μ •ν™•ν•œ 경우 많음.

// ❌
const name: string = "John";
const user: { name: string; age: number } = { name: "John", age: 30 };

// βœ…
const name = "John";
const user = { name: "John", age: 30 };

2. λͺ…μ‹œμ  λ°˜ν™˜ νƒ€μž…

ν•¨μˆ˜ 계약 λͺ…ν™•ν™”, λ°˜ν™˜ νƒ€μž… μ˜€λ³€κ²½ λ°©μ§€. 곡개 APIΒ·λ³΅μž‘ν•œ λ‘œμ§μ—μ„œ ν•„μˆ˜.

function calculateTotal(items: Item[]): number {
  return items.reduce((sum, item) => sum + item.price, 0);
}
async function fetchUser(id: string): Promise<User> {
  const res = await fetch(`/api/users/${id}`);
  return res.json();
}

3. any μ‚¬μš© κΈˆμ§€

νƒ€μž… μ•ˆμ „μ„±Β·μžλ™μ™„μ„± λ¬΄νš¨ν™”. unknown + νƒ€μž… κ°€λ“œ λ˜λŠ” ꡬ체 νƒ€μž… μ‚¬μš©.

// ❌
function process(data: any) {
  return data.value;
}

// βœ…
function process(data: unknown): number {
  if (typeof data === "object" && data !== null && "value" in data)
    return (data as { value: number }).value;
  throw new Error("Invalid data");
}

ν•¨μˆ˜ Β· μ œλ„€λ¦­

  • ν•¨μˆ˜: μΈμžΒ·λ°˜ν™˜ νƒ€μž… λͺ…μ‹œ. μ˜€λ²„λ‘œλ“œ μ‹œ κ΅¬ν˜„ μ‹œκ·Έλ‹ˆμ²˜λŠ” μœ λ‹ˆμ˜¨μœΌλ‘œ.
  • μ œλ„€λ¦­: T, K extends keyof T λ“± μ œμ•½ λͺ…μ‹œ. getProperty<T, K extends keyof T>(obj: T, key: K): T[K] νŒ¨ν„΄ ν™œμš©.

νƒ€μž… κ°€λ“œ

  • typeof, instanceof, in으둜 λΆ„κΈ° ν›„ νƒ€μž… 쒁히기
  • λ³΅μž‘ν•œ κ²€μ‚¬λŠ” μ‚¬μš©μž μ •μ˜ κ°€λ“œ (value): value is T μ‚¬μš©

ν…œν”Œλ¦Ώ: assets/types.guards.ts

tsconfig

  • ν”„λ‘œμ νŠΈ 성격에 λ§žλŠ” tsconfigλ₯Ό μ‚¬μš©
  • νƒ€μž… μ•ˆμ •μ„±μ„ ν•΄μΉ˜μ§€ μ•ŠλŠ” μ„ μ—μ„œλ§Œ μ˜΅μ…˜μ„ μ‘°μ •
  • μ•±/μ„œλ²„/λΌμ΄λΈŒλŸ¬λ¦¬λŠ” μ„€μ • νŒŒμΌμ„ 뢄리
  • νƒ€μž… μ—λŸ¬ νšŒν”Ό λͺ©μ μ˜ μ˜΅μ…˜ μ™„ν™” κΈˆμ§€

ν…œν”Œλ¦Ώ:

  • assets/tsconfig.nextjs.ts
  • assets/tsconfig.node.ts
  • assets/tsconfig.react.ts

이벀트 νƒ€μž…

  • DOM / React μ΄λ²€νŠΈλŠ” λ‚΄μž₯ νƒ€μž… μ‚¬μš©
  • μ»€μŠ€ν…€ 이벀트만 별도 νƒ€μž… μ •μ˜
  • 이벀트 μž¬μ •μ˜ κΈˆμ§€

ν…œν”Œλ¦Ώ: assets/types.events.ts

μœ ν‹Έλ¦¬ν‹° νƒ€μž…

  • TypeScript λ‚΄μž₯ μœ ν‹Έλ¦¬ν‹° νƒ€μž…μ€ κ·ΈλŒ€λ‘œ μ‚¬μš©
  • μ»€μŠ€ν…€ μœ ν‹Έλ¦¬ν‹° νƒ€μž…λ§Œ μ •μ˜

ν…œν”Œλ¦Ώ: assets/types.utils.ts

μ‹€μ „ νŒ¨ν„΄

  • interface μš°μ„ : 객체 계약·확μž₯은 interface, μœ λ‹ˆμ˜¨/μΈν„°μ„Ήμ…˜μ€ type. API μ„€λͺ…은 λͺ…μ‚¬ν˜•μœΌλ‘œ μž‘μ„± (/** λΉ„ν™œμ„±ν™” μƒνƒœ */).
  • as const: λ¦¬ν„°λŸ΄Β·κ°μ²΄ λΆˆλ³€ 보쑴. typeof obj[keyof typeof obj] 둜 μ΄λ„˜μ²˜λŸΌ ν™œμš©.
  • λΈŒλžœλ“œ νƒ€μž…: type UserId = string & { readonly brand: unique symbol } 둜 동일 μ›μ‹œ νƒ€μž… ꡬ뢄.
  • νƒ€μž… 단언 μ΅œμ†Œν™”: as λŒ€μ‹  νƒ€μž… κ°€λ“œ.
  • μ œλ„€λ¦­ μ œμ•½: T extends object λ“± λͺ…μ‹œ.

νƒ€μž… μ—λŸ¬ ν•΄κ²°

μ—λŸ¬λŒ€μ‘
Type 'X' is not assignable to type 'Y'νƒ€μž… κ°€λ“œλ‘œ λΆ„κΈ° ν›„ ν• λ‹Ή
Property 'X' does not exist on type 'Y'νƒ€μž… ν™•μž₯ λ˜λŠ” optional
Object is possibly 'null' or 'undefined'if (x == null) / ?. / ??
Argument of type 'X' is not assignable to parameter of type 'Y'μ œλ„€λ¦­ T[] λ˜λŠ” μ˜€λ²„λ‘œλ“œ
Type 'X' cannot be used as an index typekeyof typeof obj μ‚¬μš©

디버깅: ν˜Έλ²„λ‘œ μΆ”λ‘  확인, κ°€λ“œΒ·μ œλ„€λ¦­Β·μœ ν‹Έλ¦¬ν‹° νƒ€μž…μœΌλ‘œ ν•΄κ²° ν›„ asλŠ” μ΅œν›„ μˆ˜λ‹¨.

μ°Έκ³ 

이 λ¬Έμ„œλ“€μ€ κ·œμΉ™μ΄ μ•„λ‹ˆλΌ 참고용, νŒλ‹¨ 기쀀은 각 skill λ¬Έμ„œλ₯Ό μš°μ„ 

  • TypeScript Handbook - TypeScript 곡식 κ°œλ…Β·νƒ€μž… μ‹œμŠ€ν…œ 레퍼런슀
  • Playground - νƒ€μž… λ™μž‘ μ‹€ν—˜ 및 예제 κ²€μ¦μš©

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.