summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAcid Chicken (硫酸鶏) <root@acid-chicken.com>2019-02-01 21:08:49 +0900
committerGitHub <noreply@github.com>2019-02-01 21:08:49 +0900
commit3b30ad5404f458331133e659a04f95e0973d18a8 (patch)
tree4d6ef4e1cade2533ee320a650dbf6b674494fd7c /src
parentUpdate @fortawesome/free-regular-svg-icons requirement (#4076) (diff)
downloadmisskey-3b30ad5404f458331133e659a04f95e0973d18a8.tar.gz
misskey-3b30ad5404f458331133e659a04f95e0973d18a8.tar.bz2
misskey-3b30ad5404f458331133e659a04f95e0973d18a8.zip
Create type definition for 'nested-property' (#4004)
* Create type definition for 'nested-property' * Follow lint
Diffstat (limited to 'src')
-rw-r--r--src/@types/nested-property.d.ts19
-rw-r--r--src/chart/index.ts2
-rw-r--r--src/server/web/docs.ts2
3 files changed, 21 insertions, 2 deletions
diff --git a/src/@types/nested-property.d.ts b/src/@types/nested-property.d.ts
new file mode 100644
index 0000000000..6990952efd
--- /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<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;
+}
diff --git a/src/chart/index.ts b/src/chart/index.ts
index b550e5eb4b..3869224d09 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 94c18d9996..84dbe6f094 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 };