Skip to content

Commit 0b773f1

Browse files
authored
fix: improve typings of constructor helpers (#292)
1 parent 29843e3 commit 0b773f1

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

postcss-selector-parser.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,13 @@ declare namespace parser {
532532
interface Identifier extends Base {
533533
type: "id";
534534
}
535-
function id(opts: any): any;
535+
function id(opts: any): Identifier;
536536
function isIdentifier(node: any): node is Identifier;
537537

538538
interface Nesting extends Base {
539539
type: "nesting";
540540
}
541-
function nesting(opts: any): any;
541+
function nesting(opts?: any): Nesting;
542542
function isNesting(node: any): node is Nesting;
543543

544544
interface String extends Base {
@@ -550,6 +550,6 @@ declare namespace parser {
550550
interface Universal extends Base {
551551
type: "universal";
552552
}
553-
function universal(opts?: NamespaceOptions): any;
553+
function universal(opts?: NamespaceOptions): Universal;
554554
function isUniversal(node: any): node is Universal;
555555
}

src/__tests__/constructors.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import test from 'ava';
2+
import parser from '../index.js';
3+
4+
test('constructors#nesting', (t) => {
5+
t.deepEqual(parser.nesting().toString(), '&');
6+
t.deepEqual(parser.nesting({}).toString(), '&');
7+
});

0 commit comments

Comments
 (0)