fix: add new window property to interface definition

This commit is contained in:
Antoine Chalifour 2019-10-03 13:30:01 +02:00 committed by antoinechalifour
parent 7a8b158188
commit b35baa069f
4 changed files with 5 additions and 6 deletions

View File

@ -34,11 +34,9 @@ export interface AppStateInterface {
} }
export default class App extends Component<{}, AppStateInterface> { export default class App extends Component<{}, AppStateInterface> {
public state: AppStateInterface = { public state: AppStateInterface = {
// @ts-ignore
logoUrl: window.VERDACCIO_LOGO, logoUrl: window.VERDACCIO_LOGO,
user: {}, user: {},
// @ts-ignore scope: window.VERDACCIO_SCOPE || '',
scope: window.VERDACCIO_SCOPE ? `${window.VERDACCIO_SCOPE}:` : '',
showLoginModal: false, showLoginModal: false,
isUserLoggedIn: false, isUserLoggedIn: false,
packages: [], packages: [],

View File

@ -10,10 +10,8 @@ jest.mock('../../../package.json', () => ({
describe('<Footer /> component', () => { describe('<Footer /> component', () => {
let wrapper; let wrapper;
beforeEach(() => { beforeEach(() => {
// @ts-ignore : Property 'VERDACCIO_VERSION' does not exist on type 'Window'
window.VERDACCIO_VERSION = 'v.1.0.0'; window.VERDACCIO_VERSION = 'v.1.0.0';
wrapper = mount(<Footer />); wrapper = mount(<Footer />);
// @ts-ignore : Property 'VERDACCIO_VERSION' does not exist on type 'Window'
delete window.VERDACCIO_VERSION; delete window.VERDACCIO_VERSION;
}); });

View File

@ -30,7 +30,6 @@ const colors = {
// Main colors // Main colors
// ------------------------- // -------------------------
// @ts-ignore
primary: window.VERDACCIO_PRIMARY_COLOR || '#4b5e40', primary: window.VERDACCIO_PRIMARY_COLOR || '#4b5e40',
secondary: '#20232a', secondary: '#20232a',
}; };

View File

@ -7,6 +7,10 @@ export interface VerdaccioOptions {
declare global { declare global {
interface Window { interface Window {
__VERDACCIO_BASENAME_UI_OPTIONS: VerdaccioOptions; __VERDACCIO_BASENAME_UI_OPTIONS: VerdaccioOptions;
VERDACCIO_PRIMARY_COLOR: string;
VERDACCIO_LOGO: string;
VERDACCIO_SCOPE: string;
VERDACCIO_VERSION: string;
VERDACCIO_API_URL: string; VERDACCIO_API_URL: string;
} }
} }