From 0c44e82ddc8a063660091c2aede9e1cac791f455 Mon Sep 17 00:00:00 2001 From: Wendell Date: Fri, 6 Sep 2019 20:39:56 +0800 Subject: [PATCH] fix(module:editor): fix type any (#4105) close #4099 --- components/code-editor/demo/complex.ts | 7 +++++-- components/code-editor/demo/full-control.ts | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/code-editor/demo/complex.ts b/components/code-editor/demo/complex.ts index 72d2c75cb68..17ab09b9ccd 100644 --- a/components/code-editor/demo/complex.ts +++ b/components/code-editor/demo/complex.ts @@ -74,13 +74,16 @@ export class NzDemoCodeEditorComplexComponent { } console.log(flatten(['1', 2, [[3]]]))`; + private document: Document; // tslint:disable-next-line no-any - constructor(@Inject(DOCUMENT) private document: any, private renderer: Renderer2) {} + constructor(@Inject(DOCUMENT) document: any, private renderer: Renderer2) { + this.document = document; + } toggleFullScreen(): void { this.fullScreen = !this.fullScreen; - this.renderer.setStyle((this.document as Document).body, 'overflow-y', this.fullScreen ? 'hidden' : null); + this.renderer.setStyle(this.document.body, 'overflow-y', this.fullScreen ? 'hidden' : null); this.editorComponent.layout(); this.tooltip.hide(); } diff --git a/components/code-editor/demo/full-control.ts b/components/code-editor/demo/full-control.ts index fd38d21f9d5..7dbad5a428f 100644 --- a/components/code-editor/demo/full-control.ts +++ b/components/code-editor/demo/full-control.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { editor } from 'monaco-editor'; // tslint:disable-next-line no-any declare const monaco: any; @@ -17,16 +18,14 @@ declare const monaco: any; ] }) export class NzDemoCodeEditorFullControlComponent { - // tslint:disable-next-line no-any - editor: any; + editor: editor.ICodeEditor; code = `import { NzCodeEditorModule } from 'ng-zorro-antd/code-editor' @Component({}) export class SomeComponent {}`; - // tslint:disable-next-line no-any - onEditorInit(e: any): void { + onEditorInit(e: editor.ICodeEditor): void { this.editor = e; this.editor.setModel(monaco.editor.createModel("console.log('Hello ng-zorro-antd')", 'typescript')); }