From e460c9a23d144472ec25d6aa0bf10622d836f616 Mon Sep 17 00:00:00 2001 From: Paul Sherman Date: Thu, 28 Dec 2017 15:59:56 -0600 Subject: [PATCH 1/6] Add wrapper attributes/classes to TypeScript types --- types/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index ba23174bd..cc0fd1a62 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -40,6 +40,9 @@ interface BaseWrapper { contains (selector: Selector): boolean exists (): boolean + attributes(): { [name: string]: string } + classes(): Array + hasAttribute (attribute: string, value: string): boolean hasClass (className: string): boolean hasProp (prop: string, value: any): boolean From c391706746edb15920fd9052867a2708ed0a6a03 Mon Sep 17 00:00:00 2001 From: Paul Sherman Date: Thu, 28 Dec 2017 16:02:01 -0600 Subject: [PATCH 2/6] Add wrapper attributes/classes to Flow types --- flow/wrapper.flow.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flow/wrapper.flow.js b/flow/wrapper.flow.js index a34d7e8d0..b86f0c1d6 100644 --- a/flow/wrapper.flow.js +++ b/flow/wrapper.flow.js @@ -7,6 +7,8 @@ declare type Selector = any declare interface BaseWrapper { // eslint-disable-line no-undef at(index: number): Wrapper | void, + attributes(): { [name: string]: string }, + classes(): Array, contains(selector: Selector): boolean | void, emitted(event?: string): { [name: string]: Array> } | Array> | void, emittedByOrder(): Array<{ name: string; args: Array }> | void, From e1d3dd39c15350912affe9b2480413d0db79fead Mon Sep 17 00:00:00 2001 From: Paul Sherman Date: Thu, 28 Dec 2017 16:12:47 -0600 Subject: [PATCH 3/6] Add wrapper props to TypeScript types --- types/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index cc0fd1a62..938894567 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -42,7 +42,8 @@ interface BaseWrapper { attributes(): { [name: string]: string } classes(): Array - + props(): { [name: string]: any } + hasAttribute (attribute: string, value: string): boolean hasClass (className: string): boolean hasProp (prop: string, value: any): boolean From e2327fc7580db329ad0a31a2a035fc0ddd3ea304 Mon Sep 17 00:00:00 2001 From: Paul Sherman Date: Thu, 28 Dec 2017 16:13:41 -0600 Subject: [PATCH 4/6] Add wrapper props to Flow types --- flow/wrapper.flow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/flow/wrapper.flow.js b/flow/wrapper.flow.js index b86f0c1d6..307dfb298 100644 --- a/flow/wrapper.flow.js +++ b/flow/wrapper.flow.js @@ -24,6 +24,7 @@ declare interface BaseWrapper { // eslint-disable-line no-undef isEmpty(): boolean | void, isVueInstance(): boolean | void, name(): string | void, + props(): { [name: string]: any }, text(): string | void, setData(data: Object): void, setComputed(computed: Object): void, From b60b73d9d54637db20843f4044e26b93ca637c40 Mon Sep 17 00:00:00 2001 From: Paul Sherman Date: Thu, 28 Dec 2017 16:55:20 -0600 Subject: [PATCH 5/6] Flow types can return void --- flow/wrapper.flow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flow/wrapper.flow.js b/flow/wrapper.flow.js index 307dfb298..2286dbe4d 100644 --- a/flow/wrapper.flow.js +++ b/flow/wrapper.flow.js @@ -7,8 +7,8 @@ declare type Selector = any declare interface BaseWrapper { // eslint-disable-line no-undef at(index: number): Wrapper | void, - attributes(): { [name: string]: string }, - classes(): Array, + attributes(): { [name: string]: string } | void, + classes(): Array | void, contains(selector: Selector): boolean | void, emitted(event?: string): { [name: string]: Array> } | Array> | void, emittedByOrder(): Array<{ name: string; args: Array }> | void, @@ -24,7 +24,7 @@ declare interface BaseWrapper { // eslint-disable-line no-undef isEmpty(): boolean | void, isVueInstance(): boolean | void, name(): string | void, - props(): { [name: string]: any }, + props(): { [name: string]: any } | void, text(): string | void, setData(data: Object): void, setComputed(computed: Object): void, From daba4e7ee685a57b4c443194d34d1c0696976323 Mon Sep 17 00:00:00 2001 From: Paul Sherman Date: Thu, 28 Dec 2017 17:08:55 -0600 Subject: [PATCH 6/6] TypeScript types can return void --- types/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 938894567..3d22f3ede 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -40,9 +40,9 @@ interface BaseWrapper { contains (selector: Selector): boolean exists (): boolean - attributes(): { [name: string]: string } - classes(): Array - props(): { [name: string]: any } + attributes(): { [name: string]: string } | void + classes(): Array | void + props(): { [name: string]: any } | void hasAttribute (attribute: string, value: string): boolean hasClass (className: string): boolean