Skip to content

Commit

Permalink
More fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Nov 14, 2022
1 parent e71b7ce commit 89722f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
8 changes: 1 addition & 7 deletions src/compiler/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
ObjectFlags, ObjectType, RelationComparisonResult, Signature, SignatureCheckMode,
SignatureFlags, SnippetKind, SortedReadonlyArray, stableSort, Symbol, SymbolFlags, symbolName, SyntaxKind,
TransformFlags, Type, TypeFacts, TypeFlags, TypeMapKind, TypeMapper, unescapeLeadingUnderscores, VarianceFlags,
version, Version, zipWith,
zipWith,
} from "./_namespaces/ts";

/** @internal */
Expand All @@ -33,20 +33,14 @@ export interface LoggingHost {

/** @internal */
export namespace Debug {
let typeScriptVersion: Version | undefined;

/* eslint-disable prefer-const */
let currentAssertionLevel = AssertionLevel.None;
export let currentLogLevel = LogLevel.Warning;
export let isDebugging = false;
export let loggingHost: LoggingHost | undefined;
export let enableDeprecationWarnings = true;
/* eslint-enable prefer-const */

type AssertionKeys = MatchingKeys<typeof Debug, AnyFunction>;
export function getTypeScriptVersion() {
return typeScriptVersion ?? (typeScriptVersion = new Version(version));
}

export function shouldLog(level: LogLevel): boolean {
return currentLogLevel <= level;
Expand Down
2 changes: 1 addition & 1 deletion src/deprecatedCompat/deprecate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function setEnableDeprecationWarnings(value: boolean) {

let typeScriptVersion: Version | undefined;

export function getTypeScriptVersion() {
function getTypeScriptVersion() {
return typeScriptVersion ?? (typeScriptVersion = new Version(version));
}

Expand Down
5 changes: 3 additions & 2 deletions src/testRunner/unittests/factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as ts from "../_namespaces/ts";
import { setEnableDeprecationWarnings } from "../../deprecatedCompat/deprecate";

describe("unittests:: FactoryAPI", () => {
function assertSyntaxKind(node: ts.Node, expected: ts.SyntaxKind) {
Expand Down Expand Up @@ -85,11 +86,11 @@ describe("unittests:: FactoryAPI", () => {

describe("deprecations", () => {
beforeEach(() => {
ts.Debug.enableDeprecationWarnings = false;
setEnableDeprecationWarnings(false);
});

afterEach(() => {
ts.Debug.enableDeprecationWarnings = true;
setEnableDeprecationWarnings(true);
});

// https://github.com/microsoft/TypeScript/issues/50259
Expand Down

0 comments on commit 89722f1

Please sign in to comment.