Skip to content

Commit

Permalink
fix: improve typings of constructor helpers (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke authored Jul 11, 2024
1 parent 29843e3 commit 0b773f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions postcss-selector-parser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,13 @@ declare namespace parser {
interface Identifier extends Base {
type: "id";
}
function id(opts: any): any;
function id(opts: any): Identifier;
function isIdentifier(node: any): node is Identifier;

interface Nesting extends Base {
type: "nesting";
}
function nesting(opts: any): any;
function nesting(opts?: any): Nesting;
function isNesting(node: any): node is Nesting;

interface String extends Base {
Expand All @@ -550,6 +550,6 @@ declare namespace parser {
interface Universal extends Base {
type: "universal";
}
function universal(opts?: NamespaceOptions): any;
function universal(opts?: NamespaceOptions): Universal;
function isUniversal(node: any): node is Universal;
}
7 changes: 7 additions & 0 deletions src/__tests__/constructors.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import test from 'ava';
import parser from '../index.js';

test('constructors#nesting', (t) => {
t.deepEqual(parser.nesting().toString(), '&');
t.deepEqual(parser.nesting({}).toString(), '&');
});

0 comments on commit 0b773f1

Please sign in to comment.