From c5b361c9d1cd5092ec3c4ebb3c946ea1e8cbb5b4 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Wed, 5 Dec 2018 12:55:08 +0900 Subject: [PATCH 1/3] Add unknown props to Node --- types/unist/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/unist/index.d.ts b/types/unist/index.d.ts index ee61686f93..a7f6cc639d 100644 --- a/types/unist/index.d.ts +++ b/types/unist/index.d.ts @@ -26,6 +26,8 @@ export interface Node { * Must not be present if a node is generated. */ position?: Position; + + [key: string]: unknown; } /** From 95f292b29e49669cea79eb318de4945b9bf9853a Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Wed, 5 Dec 2018 12:55:18 +0900 Subject: [PATCH 2/3] Discard AnyNode type --- types/vfile-message/index.d.ts | 6 +----- types/vfile/index.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/types/vfile-message/index.d.ts b/types/vfile-message/index.d.ts index 908f72027b..5f4467e007 100644 --- a/types/vfile-message/index.d.ts +++ b/types/vfile-message/index.d.ts @@ -9,10 +9,6 @@ import * as Unist from 'unist'; declare namespace vfileMessage { - interface AnyNode extends Unist.Node { - [key: string]: unknown; - } - /** * Create a virtual message. */ @@ -25,7 +21,7 @@ declare namespace vfileMessage { * @param position Place at which the message occurred in a file (`Node`, `Position`, or `Point`, optional). * @param origin Place in code the message originates from (`string`, optional). */ - (reason: string | Error, position?: AnyNode | Unist.Position | Unist.Point, origin?: string): VFileMessage; + (reason: string | Error, position?: Unist.Node | Unist.Position | Unist.Point, origin?: string): VFileMessage; /** * Category of message. */ diff --git a/types/vfile/index.d.ts b/types/vfile/index.d.ts index efb07e288d..aec7ca88f9 100644 --- a/types/vfile/index.d.ts +++ b/types/vfile/index.d.ts @@ -98,7 +98,7 @@ declare namespace vfile { * @param position Place at which the message occurred in `vfile`. * @param ruleId Category of message. */ - message: (reason: string, position?: Unist.Point | Unist.Position | vfileMessage.AnyNode, ruleId?: string) => vfileMessage.VFileMessage; + message: (reason: string, position?: Unist.Point | Unist.Position | Unist.Node, ruleId?: string) => vfileMessage.VFileMessage; /** * Associates a fatal message with the file, then immediately throws it. * Note: fatal errors mean a file is no longer processable. @@ -107,7 +107,7 @@ declare namespace vfile { * @param position Place at which the message occurred in `vfile`. * @param ruleId Category of message. */ - fail: (reason: string, position?: Unist.Point | Unist.Position | vfileMessage.AnyNode, ruleId?: string) => never; + fail: (reason: string, position?: Unist.Point | Unist.Position | Unist.Node, ruleId?: string) => never; /** * Associates an informational message with the file, where `fatal` is set to `null`. * Calls `message()` internally. @@ -115,7 +115,7 @@ declare namespace vfile { * @param position Place at which the message occurred in `vfile`. * @param ruleId Category of message. */ - info: (reason: string, position?: Unist.Point | Unist.Position | vfileMessage.AnyNode, ruleId?: string) => vfileMessage.VFileMessage; + info: (reason: string, position?: Unist.Point | Unist.Position | Unist.Node, ruleId?: string) => vfileMessage.VFileMessage; } } From e7b92554e7ca0731739069c8c02e43bfb2279ddd Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Wed, 5 Dec 2018 17:27:19 +0900 Subject: [PATCH 3/3] Add me to contributors :smile: --- types/unist/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/unist/index.d.ts b/types/unist/index.d.ts index a7f6cc639d..2d7d37e17f 100644 --- a/types/unist/index.d.ts +++ b/types/unist/index.d.ts @@ -4,6 +4,7 @@ // Jun Lu // Hernan Rajchert // Titus Wormer +// Junyoung Choi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0