Skip to content

Commit

Permalink
#7322 fix missing types and type properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz Jurowicz committed Jun 7, 2018
1 parent 138bb96 commit e50297f
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 13 deletions.
2 changes: 1 addition & 1 deletion js/notebook/src/extension/UIOptionsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import './../global.env';
/// <reference path='../types/index.d.ts'/>

import BeakerXApi from "../tree/Utils/BeakerXApi";
import * as GistPublish from "./gistPublish/index";
Expand Down
2 changes: 1 addition & 1 deletion js/notebook/src/extension/initializationCells.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import '../global.env';
/// <reference path='../types/index.d.ts'/>

interface IInitCellsOptions {
run_on_kernel_ready: boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

/// <reference path='../../../types/index.d.ts'/>

import ColumnMenu from "../headerMenu/ColumnMenu";
import IndexMenu from "../headerMenu/IndexMenu";
import { BeakerXDataGrid } from "../BeakerXDataGrid";
Expand Down
6 changes: 3 additions & 3 deletions js/notebook/src/tableDisplay/dataGrid/column/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

/// <reference path='../../../types/index.d.ts'/>

import {IBeakerXDataGridState} from "../store/BeakerXDataStore";
import {
DEFAULT_INDEX_COLUMN_NAME, selectColumnNames, selectColumnOrder, selectColumnsFrozen,
selectColumnsFrozenNames,
selectColumnNames, selectColumnOrder,
selectColumnsVisible,
selectHasIndex
} from "../model/selectors";
import {find} from "@phosphor/algorithm";
import {IColumnPosition, IColumnsState, IColumnState} from "../interface/IColumn";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

/// <reference path='../../../types/index.d.ts'/>

import IHihglighterState, { HIGHLIGHTER_STYLE } from "../interface/IHighlighterState";
import { CellRenderer } from "@phosphor/datagrid";
import DataGridColumn from "../column/DataGridColumn";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

/// <reference path='../../../types/index.d.ts'/>

import IHihglighterState, {
HIGHLIGHTER_STYLE,
HIGHLIGHTER_TYPE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import '../../../global.env';
import ColumnManager from "../column/ColumnManager";
import createModalTemplate from './columnLimitModalTemplate';
import {BeakerXDataGrid} from "../BeakerXDataGrid";
Expand Down
2 changes: 0 additions & 2 deletions js/notebook/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"module": "ES2015",
"target": "es5",
"allowJs": true,
"declaration": true,
"declarationDir": "./types",
"moduleResolution": "Node",
"noEmit": true,
"lib": ["dom", "es5", "es2015"],
Expand Down
27 changes: 27 additions & 0 deletions js/notebook/src/types/global.env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value: V): this;
readonly size: number;
}

interface MapConstructor {
new (): Map<any, any>;
new <K, V>(entries?: ReadonlyArray<[K, V]>): Map<K, V>;
readonly prototype: Map<any, any>;
}

declare var Map: MapConstructor;

declare interface NumberConstructor {
isNaN: (number: number) => boolean,
isFinite: (number: number) => boolean
}

declare interface Array<T> {
from: (arrayLike: any[]) => any[]
}

interface GlobalEnvironment {
BEAKERX_MODULE_VERSION;
__webpack_public_path__;
Expand Down
17 changes: 17 additions & 0 deletions js/notebook/src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
/*
* Copyright 2018 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/// <reference path='./assets.d.ts'/>
/// <reference path='./global.env.d.ts'/>

// Export widget models and views, and the npm package version number.
export * from './BxHTML';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '../../../global.env';
import ColumnManager from "../column/ColumnManager";
import { BeakerXDataGrid } from "../BeakerXDataGrid";
import { BeakerXDataStore } from "../store/BeakerXDataStore";
Expand Down
70 changes: 67 additions & 3 deletions js/notebook/src/types/widgets.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
* Copyright 2018 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

export {
import {
DOMWidgetView,
DOMWidgetModel,
LayoutModel,
Expand All @@ -26,4 +26,68 @@ export {
unpack_models,
} from "@jupyter-widgets/base";

export * from "@jupyter-widgets/controls";
import {
HTMLModel,
HTMLView,
BoxModel,
BoxView,
StringModel,
DescriptionView,
DescriptionModel,
VBoxModel,
VBoxView,
TabModel,
TabView,
CheckboxModel,
CheckboxView,
SelectView,
SelectModel,
LabeledDOMWidgetView,
PasswordView,
PasswordModel,
SelectMultipleView,
SelectMultipleModel,
TextareaView,
TextareaModel,
TextView,
TextModel
} from "@jupyter-widgets/controls";

export declare const widgets: {
DOMWidgetView: typeof DOMWidgetView,
DOMWidgetModel: typeof DOMWidgetModel,
LayoutModel: typeof LayoutModel,
LayoutView: typeof LayoutView,
StyleModel: typeof StyleModel,
StyleView: typeof StyleView,
WidgetModel: typeof WidgetModel,
WidgetView: typeof WidgetView,
unpack_models: typeof unpack_models,

HTMLModel: typeof HTMLModel,
HTMLView: typeof HTMLView,
BoxModel: typeof BoxModel,
BoxView: typeof BoxView
StringModel: typeof StringModel,
DescriptionView: typeof DescriptionView,
DescriptionModel: typeof DescriptionModel,
VBoxModel: typeof VBoxModel,
VBoxView: typeof VBoxView,
TabModel: typeof TabModel,
TabView: typeof TabView,
CheckboxModel: typeof CheckboxModel,
CheckboxView: typeof CheckboxView,
SelectModel: typeof SelectModel,
SelectView: typeof SelectView,
LabeledDOMWidgetView: typeof LabeledDOMWidgetView,
PasswordModel: typeof PasswordModel,
PasswordView: typeof PasswordView,
SelectMultipleModel: typeof SelectMultipleModel,
SelectMultipleView: typeof SelectMultipleView,
TextareaModel: typeof TextareaModel,
TextareaView: typeof TextareaView,
TextModel: typeof TextModel,
TextView: typeof TextView,
};

export default widgets;
2 changes: 1 addition & 1 deletion js/notebook/src/widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

/// <reference path='./types/widgets.d.ts'/>
/// <reference path='./types/index.d.ts'/>

const base = require('@jupyter-widgets/base');
const controls = require('@jupyter-widgets/controls');
Expand Down

0 comments on commit e50297f

Please sign in to comment.