Keyword(关键字) 和 Operator(运算符、操作符) 不是一个东西,但有交集例如+、! 是 Operator,但不是 Keywordconst、this 是 Keyword,但不是 Operatornew、typeof 既是 Keyword,又是 Operator
typeof 有两种,一个是 js 中的关键字,一个是 ts 里的类型操作符TS 中的类型操作符interface T { name: string; } const t:T = {name: 'foo'}; type T0 = typeof t; // T0 即为 T同 JS 中的操作符typeof '' === 'string';
Keyword(关键字) 和 Operator(运算符、操作符) 不是一个东西,但有交集
例如
+
、!
是 Operator,但不是 Keywordconst
、this
是 Keyword,但不是 Operatornew
、typeof
既是 Keyword,又是 Operator