Skip to content

Commit

Permalink
Workaround anser wrong typings.
Browse files Browse the repository at this point in the history
The .d.ts definition file distributed along the `anser` package is
bogus, but the issue is minimal: It declares that the module exports a
namespace as `export default` when it does not.

Signed-off-by: Paul Maréchal <[email protected]>
  • Loading branch information
paul-marechal committed Nov 14, 2019
1 parent 7dc3c98 commit 19c7eb5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/console/src/browser/ansi-console-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import * as React from 'react';
import { ConsoleItem } from './console-session';
import { Severity } from '@theia/core/lib/common/severity';
import Anser from 'anser';

// TODO: Remove this workaround once issue is fixed by anser.
// REF: https://github.com/IonicaBizau/anser/issues/52
const { ansiToHtml } = (require('anser') as import('anser').default);

export class AnsiConsoleItem implements ConsoleItem {

Expand All @@ -27,7 +30,7 @@ export class AnsiConsoleItem implements ConsoleItem {
public readonly content: string,
public readonly severity?: Severity
) {
this.htmlContent = Anser.ansiToHtml(this.content, {
this.htmlContent = ansiToHtml(this.content, {
use_classes: true,
remove_empty: true
});
Expand Down

0 comments on commit 19c7eb5

Please sign in to comment.