From 8447a268737da54d44b99849bf3600a00c2f8983 Mon Sep 17 00:00:00 2001 From: Glandos Date: Wed, 27 May 2020 16:48:26 +0200 Subject: [PATCH] Better typing for css getter/setter CSSStyleDeclaration contains readonly rule, so I excluded them, otherwise it doesn't make sense I didn't touch the Runner `css()` because I don't know the exact behavior of it. --- svg.js.d.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/svg.js.d.ts b/svg.js.d.ts index 0dddfdc..0aed23b 100644 --- a/svg.js.d.ts +++ b/svg.js.d.ts @@ -4,6 +4,9 @@ // trick to keep reference to Array build-in type declare class BuiltInArray extends Array { } +// trick to have nice attribute list for CSS +declare type CSSStyleName = Exclude + declare module "@svgdotjs/svg.js" { function SVG(): Svg; @@ -1008,11 +1011,11 @@ declare module "@svgdotjs/svg.js" { toggleClass(name: string): this // prototype method register in css.js - css(): object; - css(style: string): string - css(style: string[]): object; - css(style: string, val: any): this - css(style: object): this + css(): Partial + css(style: T): CSSStyleDeclaration[T] + css(style: T): Partial + css(style: T, val: CSSStyleDeclaration[T]): this + css(style: Partial): this show(): this hide(): this visible(): boolean -- 2.39.5