Skip to content

Fix types and make sure Typescript types validate #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- run:
name: Run Linting
command: npm run lint
- run:
name: Check types
command: npm run check-types
- run:
name: Run Security Check
command: npm run security
Expand Down
9 changes: 5 additions & 4 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

import * as postcss from "postcss";
import * as postcssNode from "postcss/lib/node";

// Even though the concrete classes extend PostCSS classes, we can't extend
// PostCSS Node types here because they refer to statements that aren't
Expand All @@ -26,12 +27,12 @@ export interface NodeBase {
replaceWith(...nodes: Array<ChildNode | object>): this;

// Inherited from postcss.ContainerBase with no changes.
source?: postcss.NodeSource;
raws: postcss.NodeRaws;
source?: postcss.Source;
raws: any;
toString(stringifier?: Stringifier | Syntax): string;
error(
message: string,
options?: postcss.NodeErrorOptions
options?: postcssNode.NodeErrorOptions
): postcss.CssSyntaxError;
warn(
result: postcss.Result,
Expand Down Expand Up @@ -131,7 +132,7 @@ export type ChildNode =

export type Container = Root | Func | Interpolation;

export interface AtWord extends NodeBase {
export interface AtWord extends ContainerBase {
type: "atrule";
parent: Container;
name: string;
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"ci:coverage": "nyc npm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:test": "npm run test",
"lint": "eslint lib test --fix --cache",
"check-types": "tsc --noEmit",
"lint-staged": "lint-staged",
"security": "npm audit --audit-level=moderate",
"test": "ava"
Expand Down Expand Up @@ -48,7 +49,8 @@
"prettier": "^2.1.2",
"rewiremock": "^3.14.3",
"strip-ansi": "^6.0.0",
"text-table": "^0.2.0"
"text-table": "^0.2.0",
"typescript": "^4.2.3"
},
"peerDependencies": {
"postcss": "^8.0.9"
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}