svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
11.04k stars 1.08k forks source link

Typescript .css(): {} is not assignable to parameter of type 'string' #1163

Closed m-hagberg closed 1 year ago

m-hagberg commented 3 years ago

Bug report

Working

svg.css('border', '1px solid red')

Not working

svg.css({ border: '1px solid red' })
  Overload 1 of 5, '(style: string): string', gave the following error.
    Argument of type '{ border: string; }' is not assignable to parameter of type 'string'.
  Overload 2 of 5, '(style: CSSStyleDeclaration): Svg', gave the following error.
    Argument of type '{ border: string; }' is not assignable to parameter of type 'CSSStyleDeclaration'.
      Type '{ border: string; }' is missing the following properties from type 'CSSStyleDeclaration': alignContent, alignItems, alignSelf, alignmentBaseline, and 389 more.
  Overload 3 of 5, '(style: string[]): CSSStyleDeclaration', gave the following error.
    Argument of type '{ border: string; }' is not assignable to parameter of type 'string[]'.
      Object literal may only specify known properties, and 'border' does not exist in type 'string[]'.

It does compile, but it throws the Typescript error.

Fuzzyma commented 1 year ago

was fixed at some point