mirror of
https://github.com/apache/superset.git
synced 2024-09-19 20:19:37 -04:00
fix: make translation module type check correctly (#140)
This commit is contained in:
parent
368ed3cb5b
commit
a35f88a69e
@ -3,7 +3,7 @@
|
|||||||
import Translator from './Translator';
|
import Translator from './Translator';
|
||||||
import { TranslatorConfig } from './types';
|
import { TranslatorConfig } from './types';
|
||||||
|
|
||||||
let singleton: Translator;
|
let singleton: Translator | undefined;
|
||||||
let isConfigured = false;
|
let isConfigured = false;
|
||||||
|
|
||||||
function configure(config?: TranslatorConfig) {
|
function configure(config?: TranslatorConfig) {
|
||||||
@ -15,10 +15,11 @@ function configure(config?: TranslatorConfig) {
|
|||||||
|
|
||||||
function getInstance() {
|
function getInstance() {
|
||||||
if (!isConfigured) {
|
if (!isConfigured) {
|
||||||
console.warn('You must call configure(...) before calling other methods');
|
console.warn('You should call configure(...) before calling other methods');
|
||||||
if (!singleton) {
|
}
|
||||||
singleton = new Translator();
|
|
||||||
}
|
if (typeof singleton === 'undefined') {
|
||||||
|
singleton = new Translator();
|
||||||
}
|
}
|
||||||
|
|
||||||
return singleton;
|
return singleton;
|
||||||
|
Loading…
Reference in New Issue
Block a user