Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Feature/globby#9

Merged
DeividasBakanas merged 15 commits into
masterfrom
feature/globby
Nov 6, 2017
Merged

Feature/globby#9
DeividasBakanas merged 15 commits into
masterfrom
feature/globby

Conversation

@DeividasBakanas
Copy link
Copy Markdown
Member

No description provided.

Comment thread @types/contracts.d.ts Outdated
author?: string;
license?: string;
}
export declare type VarType = "var" | "let" | "const";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't use an enum with string values?

Comment thread src/validators.ts Outdated
export function IsVarTypeValid(varType: string | boolean | undefined): varType is VarType | undefined {
return (varType == null || varType === "const" || varType === "let" || varType === "var");
export function IsVarTypeValid(varType: string): varType is VarType {
return (varType === "const" || varType === "let" || varType === "var");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use enum values to check

Comment thread src/validators.ts Outdated
}

export function IsVarTypeValid(varType: string): varType is VarType {
return (varType === VarType.Const || varType === VarType.Let || varType === VarType.Var);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Object.values

Comment thread src/validators.ts Outdated

export function IsVarTypeValid(varType: string): varType is VarType {
return (varType === VarType.Const || varType === VarType.Let || varType === VarType.Var);
const values = Object.values(VarType) as string[];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use generic

Comment thread tsconfig.json Outdated
"declarationDir": "@types"
"declarationDir": "@types",
"lib": [
"es2017"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use es2017.object

Comment thread src/validators.ts Outdated
export function IsVarTypeValid(varType: string): varType is VarType {
const values = Object.values(VarType) as string[];
const values = Object.values<string>(VarType);
return (values.indexOf(varType) >= 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use -1

@DeividasBakanas DeividasBakanas merged commit 9cad742 into master Nov 6, 2017
@DeividasBakanas DeividasBakanas deleted the feature/globby branch November 6, 2017 16:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants