type B = 5 | 10; // Bはより小さい集合 type C = string | number; // Cはより大きい集合 // B extends A は真({5,10} ⊆ {すべての数値}) // A extends C は真({すべての数値} ⊆ {string|number}) AIの型知識チェック
assignable to parameter of type '"left" | "right" | "center"'. AIは特にエラーの有無で判断する傾向がある (エラーが出ていたら必死に直そうとする) →型エラーを適切に出す書き方はAIが処理を正しく理解する手助けとなる 型の表現力とAIの解釈
{ lines.push(``); lines.push(` if (input.${key} !== undefined) {`); if (prop.type === "string") { lines.push(` if (typeof input.${key} !== "string") {`); lines.push(` errors.push("${key} must be a string");`); lines.push(` }`); } else if (prop.type === "number") { lines.push(` if (typeof input.${key} !== "number") {`); lines.push(` errors.push("${key} must be a number");`); lines.push(` }`);・・・ 型からスキルへの昇華