在spec.ts例如:Dom.spec.ts
describe('matchesSelector', () => {
let result: boolean;
let matchelement: HTMLElement;
it('Matches for the opera browser', () => {
matchelement.matches = matchelement.msMatchesSelector = null;
result = Dom.matches(matchelement, '#match');
expect(result).toBe(true);
});
Run Code Online (Sandbox Code Playgroud)
在上面的代码中调用matchelement.msMatchesSelector中的msmatchesSelector时,它会在lib.dom.ts中获取specfic类型.当我将打字稿版本升级到3.0时,它会重现以下错误
spec\dom.spec.ts(304,49): error TS2339: Property 'msMatchesSelector' does not exist on type 'HTMLElement'.
Run Code Online (Sandbox Code Playgroud)
但它在我以前的打字稿版本2.6.2中工作正常
typescript ×1