Typescript library for SVG

2019-09-21 01:44发布

I've been using Raphael with an Angular 4 app and also tried to switch to Snap. Neither of these support typescript very well (at all?).

Does anyone know of a library that includes full typescript types and doesn't require a PhD to get it working with Angular2/4/5?

If not, I'm thinking I will create a pure typescript library but that's a lot of work.

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-09-21 02:24

Just install the @types package for Raphael.

It is maintained by the TypeScript community. These are people who like yourself, write apps in TypeScript and use Raphael.

If you find that the declarations are imperfect, you can open an issue (or a pull request) on https://github.com/DefinitelyTyped/DefinitelyTyped

Installation:

With NPM:

$ npm install --save @types/raphael

With JSPM:

$ jspm install npm:@types/raphael

With Yarn:

$ yarn add @types/raphael

Usage:

import Raphael from 'raphael';

The same applies to snapsvg

查看更多
登录 后发表回答