diff --git a/src/mol-app/component/parameter/boolean.tsx b/src/mol-app/component/parameter/boolean.tsx index d5ec7529ed8a225b07904a37d7cbf54c64856b68..bb93409e4f24b135c5de0efe6db297d6e92bfdd7 100644 --- a/src/mol-app/component/parameter/boolean.tsx +++ b/src/mol-app/component/parameter/boolean.tsx @@ -9,7 +9,7 @@ import { ParamDefinition as PD } from '../../../mol-util/param-definition'; export interface BooleanParamComponentProps { label: string - param: PD.Boolean + param: PD.BooleanParam value: boolean onChange(v: boolean): void } diff --git a/src/mol-io/reader/mol2/parser.ts b/src/mol-io/reader/mol2/parser.ts index 1f727b61fc3982636874e200ac44297234ebf8b0..4e9429f31c8937bb4b4ffa0cafa5d87027aca480 100644 --- a/src/mol-io/reader/mol2/parser.ts +++ b/src/mol-io/reader/mol2/parser.ts @@ -84,7 +84,7 @@ function handleMolecule(state: State) { molecule.mol_comment = getTokenString(tokenizer) } -function isStatus_bit(aString: String): Boolean { +function isStatus_bit(aString: string): boolean { if (aString.includes('DSPMOD') || aString.includes('TYPECOL') || aString.includes('CAP') || aString.includes('BACKBONE') || aString.includes('DICT') || aString.includes('ESSENTIAL') || aString.includes('WATER') || aString.includes('DIRECT')) { diff --git a/src/mol-plugin/ui/controls/parameters.tsx b/src/mol-plugin/ui/controls/parameters.tsx index 4fafacd552a474a4622d5b04e1a227479b5883d3..84f9b0742dbd920a11b3f12a6115d9548ffe23d5 100644 --- a/src/mol-plugin/ui/controls/parameters.tsx +++ b/src/mol-plugin/ui/controls/parameters.tsx @@ -97,7 +97,7 @@ export abstract class SimpleParam<P extends PD.Any> extends React.PureComponent< } } -export class BoolControl extends SimpleParam<PD.Boolean> { +export class BoolControl extends SimpleParam<PD.BooleanParam> { onClick = (e: React.MouseEvent<HTMLButtonElement>) => { this.update(!this.props.value); e.currentTarget.blur(); } renderControl() { return <button onClick={this.onClick} disabled={this.props.isDisabled}> diff --git a/src/mol-util/console-logger.ts b/src/mol-util/console-logger.ts index c09f08b9aaa412e2f8a9e155fdbb3c01cfe7c8bc..8d04c03fb835ef96ee3bd36d85e8ede19ff35b8c 100644 --- a/src/mol-util/console-logger.ts +++ b/src/mol-util/console-logger.ts @@ -25,7 +25,7 @@ export namespace ConsoleLogger { console.log(`[${tag}] ${msg}`); } - export function logId(guid: string | String, tag: string, msg: string) { + export function logId(guid: string, tag: string, msg: string) { console.log(`[${guid}][${tag}] ${msg}`); } @@ -38,7 +38,7 @@ export namespace ConsoleLogger { console.error(`[Warn] (${ctx}) ${e}`); } - export function errorId(guid: string | String, e: any) { + export function errorId(guid: string, e: any) { console.error(`[${guid}][Error] ${e}`); if (e.stack) console.error(e.stack); } diff --git a/src/mol-util/param-definition.ts b/src/mol-util/param-definition.ts index 92496fc63e303412c2ebbaada2a99df030b2cb8a..d94f32864c051da74ed8261c21b74f34cbe65ceb 100644 --- a/src/mol-util/param-definition.ts +++ b/src/mol-util/param-definition.ts @@ -76,11 +76,11 @@ export namespace ParamDefinition { return setInfo<MultiSelect<E, T>>({ type: 'multi-select', defaultValue, options }, info) } - export interface Boolean extends Base<boolean> { + export interface BooleanParam extends Base<boolean> { type: 'boolean' } - export function Boolean(defaultValue: boolean, info?: Info): Boolean { - return setInfo<Boolean>({ type: 'boolean', defaultValue }, info) + export function Boolean(defaultValue: boolean, info?: Info): BooleanParam { + return setInfo<BooleanParam>({ type: 'boolean', defaultValue }, info) } export interface Text<T extends string = string> extends Base<T> { @@ -237,7 +237,7 @@ export namespace ParamDefinition { } export type Any = - | Value<any> | Select<any> | MultiSelect<any> | Boolean | Text | Color | Vec3 | Numeric | FileParam | Interval | LineGraph + | Value<any> | Select<any> | MultiSelect<any> | BooleanParam | Text | Color | Vec3 | Numeric | FileParam | Interval | LineGraph | ColorScale<any> | Group<any> | Mapped<any> | Converted<any, any> | Conditioned<any, any, any> | ScriptExpression | ObjectList export type Params = { [k: string]: Any } diff --git a/tslint.json b/tslint.json index 1c88592ea6631a73315ede0d282296f9626b68c6..ecf0639ee5c4ae7ba5c27ed412efe60d3867995c 100644 --- a/tslint.json +++ b/tslint.json @@ -6,6 +6,7 @@ ], "arrow-parens": false, "no-var-keyword": true, + "no-construct": true, "ordered-imports": [false], "trailing-comma": [false], "class-name": false, @@ -17,6 +18,12 @@ true, "spaces" ], + "ban-types": [ + true, + ["String", "Use primitive 'string' instead."], + ["Boolean", "Use primitive 'boolean' instead."], + ["Number", "Use primitive 'number' instead."] + ], "no-eval": true, "no-internal-module": true, "no-trailing-whitespace": true,