Skip to content
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

improve typings of constructor helpers #292

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
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(), '&');
});