Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
fix: get script language level as number always
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyw authored and nchanged committed Feb 5, 2019
1 parent a338809 commit 4ee2a7d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/CombinedTargetAndLanguageLevel.ts
@@ -1,4 +1,5 @@
import { ScriptTarget } from "./File";
import { getScriptLevelNumber } from "./TypescriptConfig";

export class CombinedTargetAndLanguageLevel {
constructor(private combination: string) {
Expand All @@ -10,10 +11,10 @@ export class CombinedTargetAndLanguageLevel {
return target;
}

public getLanguageLevel(): ScriptTarget {
public getLanguageLevel(): ScriptTarget & number {
const [, languageLevel] = this.splitCombination();
const level = languageLevel && Object.keys(ScriptTarget).find(t => t.toLowerCase() === languageLevel);
return level ? ScriptTarget[level] : undefined;

return getScriptLevelNumber(languageLevel);
}

public getLanguageLevelOrDefault(defaultLanguageLevel: ScriptTarget = ScriptTarget.ES2018) {
Expand Down

0 comments on commit 4ee2a7d

Please sign in to comment.