From 76a3dbf883272e78831fc9b92be0fedf95c0cbd7 Mon Sep 17 00:00:00 2001 From: Bruno Ribeito Date: Mon, 26 Feb 2018 23:27:53 +0000 Subject: [PATCH 1/2] Enforce option value via types --- typings/xterm.d.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index dd08b55e..2eb732ac 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -487,12 +487,7 @@ declare module 'xterm' { * @param key The option key. */ getOption(key: 'handler'): (data: string) => void; - /** - * Retrieves an option's value from the terminal. - * @param key The option key. - */ - getOption(key: string): any; - + /** * Sets an option on the terminal. * @param key The option key. @@ -548,12 +543,10 @@ declare module 'xterm' { */ setOption(key: 'theme', value: ITheme): void; /** - * Sets an option on the terminal. + * Retrieves an option's value from the terminal. * @param key The option key. - * @param value The option value. */ - setOption(key: string, value: any): void; - + setOption(key: 'cols' | 'rows', value: number): void; /** * Tells the renderer to refresh terminal content between two rows * (inclusive) at the next opportunity. From c51fa238ff956d2d3ad1f376bf34fdd3df1b1d24 Mon Sep 17 00:00:00 2001 From: Bruno Ribeito Date: Tue, 27 Feb 2018 23:18:33 +0000 Subject: [PATCH 2/2] Readd any overloads --- typings/xterm.d.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 2eb732ac..32c8b0a0 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -487,7 +487,12 @@ declare module 'xterm' { * @param key The option key. */ getOption(key: 'handler'): (data: string) => void; - + /** + * Retrieves an option's value from the terminal. + * @param key The option key. + */ + getOption(key: string): any; + /** * Sets an option on the terminal. * @param key The option key. @@ -543,10 +548,18 @@ declare module 'xterm' { */ setOption(key: 'theme', value: ITheme): void; /** - * Retrieves an option's value from the terminal. + * Sets an option on the terminal. * @param key The option key. + * @param value The option value. */ setOption(key: 'cols' | 'rows', value: number): void; + /** + * Sets an option on the terminal. + * @param key The option key. + * @param value The option value. + */ + setOption(key: string, value: any): void; + /** * Tells the renderer to refresh terminal content between two rows * (inclusive) at the next opportunity.