From 0504976c2eb6465f0183a618bc591f32b8828bef Mon Sep 17 00:00:00 2001 From: Christian Murphy Date: Wed, 29 Apr 2020 09:10:58 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#44341=20hast:=20up?= =?UTF-8?q?date=20hast=20property=20type=20by=20@ChristianMurphy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update hast property type documented at https://github.com/syntax-tree/hast#properties properties are primitive types or a list of number or string. discussed at https://github.com/rehypejs/rehype-document/pull/9#discussion_r417123004 * add more tests for properties --- types/hast/hast-tests.ts | 3 +++ types/hast/index.d.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/hast/hast-tests.ts b/types/hast/hast-tests.ts index 68699d6dd3..595c642818 100644 --- a/types/hast/hast-tests.ts +++ b/types/hast/hast-tests.ts @@ -73,6 +73,9 @@ const properties: Properties = { propertyName2: ['propertyValue2', 'propertyValue3'], propertyName3: true, propertyName4: 47, + propertyName5: [4, "4"], + propertyName6: null, + propertyName7: undefined }; function getElement(): Element { diff --git a/types/hast/index.d.ts b/types/hast/index.d.ts index 85aa548b3b..dd08f9da82 100644 --- a/types/hast/index.d.ts +++ b/types/hast/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/syntax-tree/hast // Definitions by: lukeggchapman // Junyoung Choi +// Christian Murphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -72,7 +73,7 @@ export interface Element extends Parent { * Represents information associated with an element. */ export interface Properties { - [PropertyName: string]: any; + [PropertyName: string]: boolean | number | string | null | undefined | Array; } /**