トップページ > プログラム > 2015年10月24日 > otxAXsrh

書き込み順位&時間帯一覧

17 位/173 ID中時間01234567891011121314151617181920212223Total
書き込み数0000000000000030000000003



使用した名前一覧書き込んだスレッド一覧
デフォルトの名無しさん
TypeScript part2 [転載禁止]©2ch.net

書き込みレス一覧

TypeScript part2 [転載禁止]©2ch.net
62 :デフォルトの名無しさん[sage]:2015/10/24(土) 14:26:29.93 ID:otxAXsrh
>>59
class Base {
getThis(): Base { return this; }
}
class Derived extends Base {
print(): void { console.log('Derived'); }
}
let derived = new Derived();
derived.getThis().print(); // 1.6.2だとBaseにprint()がねーよと怒られる
1.7だと
getThis(): this { return this; }
にする事でコンパイル通ってちゃんと実行も出来る

って事は理解したけど、equals(other: this)のthisって自分の型名のエイリアス
として使えるから便利って事であってるの?
TypeScript part2 [転載禁止]©2ch.net
63 :デフォルトの名無しさん[sage]:2015/10/24(土) 14:31:41.39 ID:otxAXsrh
>>60
Emacsと
https://github.com/ananthakumaran/tide
↑を使う事でVSに劣らないインテリセンス環境が出来上がるぞ(ページ内のscreencastを見るべし!)
ちなみに常用してるけどMac版Emacsは使った事ないから詳細は分からん
TypeScript part2 [転載禁止]©2ch.net
64 :デフォルトの名無しさん[sage]:2015/10/24(土) 14:48:22.39 ID:otxAXsrh
>>59
class Base {
equals(other: this): boolean { return other.name === "Derived"; }
}
class Derived extends Base {
name = "Derived";
}
let derived = new Derived();
console.log(derived.equals(derived));

だと、1.7でも(正確には1.7.0-dev.20151016)
test.ts(3,18): error TS2339: Property 'name' does not exist on type 'Base'.
って、ポリモらないけど…なんでなん?


※このページは、『2ちゃんねる』の書き込みを基に自動生成したものです。オリジナルはリンク先の2ちゃんねるの書き込みです。
※このサイトでオリジナルの書き込みについては対応できません。
※何か問題のある場合はメールをしてください。対応します。