Create type definition for 'nested-property' (#4004)
* Create type definition for 'nested-property' * Follow lint
This commit is contained in:
parent
27268fd6b7
commit
3b30ad5404
19
src/@types/nested-property.d.ts
vendored
Normal file
19
src/@types/nested-property.d.ts
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
declare module 'nested-property' {
|
||||
interface IHasNestedPropertyOptions {
|
||||
own?: boolean;
|
||||
}
|
||||
|
||||
interface IIsInNestedPropertyOptions {
|
||||
validPath?: boolean;
|
||||
}
|
||||
|
||||
export function set<T>(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;
|
||||
}
|
|
@ -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';
|
||||
|
|
|
@ -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 };
|
||||
|
|
Loading…
Reference in a new issue