autoprefixer: updated to match postcss Plugin types for postcss 7.x (#29357)

* autoprefixer: updated to match postcss Plugin types for postcss 7.x types, resolve error with Transformer type

* #29357: Renamed autoprefixer.AutoprefixerOptions to autoprefixer.Options
This commit is contained in:
murt
2018-10-10 10:29:35 +10:00
committed by Andy
parent fe3bb114a3
commit 95d7637bed
3 changed files with 21 additions and 26 deletions

View File

@@ -1,17 +1,17 @@
import * as autopref from 'autoprefixer';
import autoprefixer = require("autoprefixer");
import { Transformer } from 'postcss';
const ap: autopref.Transformer = autopref({
browsers: ['> 5%', 'last 2 versions'],
env: '',
cascade: true,
add: true,
remove: true,
supports: true,
flexbox: true,
grid: true,
stats: {},
const ap1: Transformer = autoprefixer();
const ap2: Transformer = autoprefixer({
browsers: [],
env: "test",
cascade: false,
add: false,
remove: false,
supports: false,
flexbox: false,
grid: false,
stats: {},
ignoreUnknownVersions: false,
});
const ap2: autopref.Transformer = autopref({
flexbox: 'no-2009',
});
const info: string = ap.info();

View File

@@ -1,9 +1,9 @@
// Type definitions for autoprefixer 6.7
// Type definitions for autoprefixer 9.1
// Project: https://github.com/postcss/autoprefixer
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>, murt <https://github.com/murt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Plugin, Transformer as PostcssTransformer } from 'postcss';
import { Plugin } from "postcss";
declare namespace autoprefixer {
interface Options {
@@ -16,15 +16,10 @@ declare namespace autoprefixer {
flexbox?: boolean | 'no-2009';
grid?: boolean;
stats?: any;
ignoreUnknownVersions?: boolean;
}
interface Transformer extends PostcssTransformer {
info(): string;
}
interface Autoprefixer extends Plugin<Options> {
(opts?: Options): Transformer;
}
type Autoprefixer = Plugin<Options>;
}
declare const autoprefixer: autoprefixer.Autoprefixer;

View File

@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"postcss": "^5.2.15"
"postcss": "7.x.x"
}
}