【发布时间】:2020-01-08 17:27:00
【问题描述】:
我浏览了一些 documentation in the Angular docs 并遇到了这段代码:
return this.exampleDatabase!.getRepoIssues(
this.sort.active, this.sort.direction, this.paginator.pageIndex);
这是用于空检查的 C# null-conditional 运算符的 TypeSrcript 等效项吗?
我尝试在 JSFiddle 中做一些事情,但不断收到语法错误:
例子:
const obj = { test: 'ing 123' };
console.log(obj.test);
console.log(obj!.doesntexist); // Excepting null here
但是,相反,我得到:
Uncaught SyntaxError: Unexpected token 。 在新函数 () 在 exec (typescript.js:41) 在 HTMLDocument.runScripts (typescript.js:41)
【问题讨论】:
标签: typescript