mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
extended the OptimizedSvg interface to include path, and info width and height. (#38317)
This commit is contained in:
parent
f161e550b4
commit
793e9f235f
9
types/svgo/index.d.ts
vendored
9
types/svgo/index.d.ts
vendored
@ -1,9 +1,10 @@
|
||||
// Type definitions for svgo 1.2
|
||||
// Type definitions for svgo 1.3
|
||||
// Project: https://github.com/svg/svgo
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// Gilad Gray <https://github.com/giladgray>
|
||||
// Aankhen <https://github.com/Aankhen>
|
||||
// Jan Karres <https://github.com/jankarres>
|
||||
// Gavin Gregory <https://github.com/gavingregory>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@ -201,7 +202,11 @@ interface SvgInfo {
|
||||
|
||||
interface OptimizedSvg {
|
||||
data: string;
|
||||
info: object;
|
||||
info: {
|
||||
width: string;
|
||||
height: string;
|
||||
};
|
||||
path?: string;
|
||||
}
|
||||
|
||||
declare class SVGO {
|
||||
|
||||
@ -27,5 +27,16 @@ const options: SVGO.Options = {
|
||||
svgo = new SVGO(options);
|
||||
|
||||
// SVGO instance methods
|
||||
svgo.optimize(`<?xml version="1.0" encoding="utf-8"?><svg></svg>`, { path: "filepath" })
|
||||
.then(result => result.data, error => error);
|
||||
svgo
|
||||
.optimize(`<?xml version="1.0" encoding="utf-8"?><svg></svg>`, {
|
||||
path: 'filepath',
|
||||
})
|
||||
.then(
|
||||
result => {
|
||||
result.data;
|
||||
result.info.height;
|
||||
result.info.width;
|
||||
result.path;
|
||||
},
|
||||
error => error,
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user