Skip to content

Commit 850ca96

Browse files
authored
fix: TypeScript types, add validation (#132)
1 parent 8a405d6 commit 850ca96

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
- run:
4545
name: Run Linting
4646
command: npm run lint
47+
- run:
48+
name: Check types
49+
command: npm run check-types
4750
- run:
4851
name: Run Security Check
4952
command: npm run security

lib/index.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
import * as postcss from "postcss";
13+
import * as postcssNode from "postcss/lib/node";
1314

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

2829
// Inherited from postcss.ContainerBase with no changes.
29-
source?: postcss.NodeSource;
30-
raws: postcss.NodeRaws;
30+
source?: postcss.Source;
31+
raws: any;
3132
toString(stringifier?: Stringifier | Syntax): string;
3233
error(
3334
message: string,
34-
options?: postcss.NodeErrorOptions
35+
options?: postcssNode.NodeErrorOptions
3536
): postcss.CssSyntaxError;
3637
warn(
3738
result: postcss.Result,
@@ -131,7 +132,7 @@ export type ChildNode =
131132

132133
export type Container = Root | Func | Interpolation;
133134

134-
export interface AtWord extends NodeBase {
135+
export interface AtWord extends ContainerBase {
135136
type: "atrule";
136137
parent: Container;
137138
name: string;

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"ci:coverage": "nyc npm run test && nyc report --reporter=text-lcov > coverage.lcov",
2121
"ci:test": "npm run test",
2222
"lint": "eslint lib test --fix --cache",
23+
"check-types": "tsc --noEmit",
2324
"lint-staged": "lint-staged",
2425
"security": "npm audit --audit-level=moderate",
2526
"test": "ava"
@@ -48,7 +49,8 @@
4849
"prettier": "^2.1.2",
4950
"rewiremock": "^3.14.3",
5051
"strip-ansi": "^6.0.0",
51-
"text-table": "^0.2.0"
52+
"text-table": "^0.2.0",
53+
"typescript": "^4.2.3"
5254
},
5355
"peerDependencies": {
5456
"postcss": "^8.0.9"

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)