diff --git a/src/@types/nested-property.d.ts b/src/@types/nested-property.d.ts new file mode 100644 index 000000000..6990952ef --- /dev/null +++ b/src/@types/nested-property.d.ts @@ -0,0 +1,19 @@ +declare module 'nested-property' { + interface IHasNestedPropertyOptions { + own?: boolean; + } + + interface IIsInNestedPropertyOptions { + validPath?: boolean; + } + + export function set(object: T, property: string, value: any): T; + + export function get(object: object, property: string): any; + + export function has(object: object, property: string, options?: IHasNestedPropertyOptions): boolean; + + export function hasOwn(object: object, property: string, options?: IHasNestedPropertyOptions): boolean; + + export function isIn(object: object, property: string, objectInPath: object, options?: IIsInNestedPropertyOptions): boolean; +} diff --git a/src/chart/index.ts b/src/chart/index.ts index b550e5eb4..3869224d0 100644 --- a/src/chart/index.ts +++ b/src/chart/index.ts @@ -3,7 +3,7 @@ */ import * as moment from 'moment'; -const nestedProperty = require('nested-property'); +import * as nestedProperty from 'nested-property'; import autobind from 'autobind-decorator'; import * as mongo from 'mongodb'; import db from '../db/mongodb'; diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index 94c18d999..84dbe6f09 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -17,7 +17,7 @@ import { licenseHtml } from '../../misc/license'; const constants = require('../../const.json'); import endpoints from '../api/endpoints'; const locales = require('../../../locales'); -const nestedProperty = require('nested-property'); +import * as nestedProperty from 'nested-property'; async function genVars(lang: string): Promise<{ [key: string]: any }> { const vars = {} as { [key: string]: any };