mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Add typings for nookies (#29857)
* Add typings for nookies * Set strictFunctionTypes to true * Fix get function return type * Add semicolons
This commit is contained in:
committed by
Sheetal Nandi
parent
5508e44eee
commit
c76ce3bec0
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for nookies 1.1
|
||||
// Project: https://github.com/maticzav/nookies#readme
|
||||
// Definitions by: Andreas Bergqvist <https://github.com/andreasbergqvist>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { NextContext } from 'next';
|
||||
import { CookieParseOptions, CookieSerializeOptions } from 'cookie';
|
||||
|
||||
export function parseCookies(ctx: NextContext, options?: CookieParseOptions): { [key: string]: string };
|
||||
export function setCookie(ctx: NextContext, name: string, value: string, options?: CookieSerializeOptions): void;
|
||||
export function destroyCookie(ctx: NextContext, name: string): void;
|
||||
|
||||
declare const Nookies: {
|
||||
set(ctx: NextContext, name: string, value: string, options?: CookieSerializeOptions): void;
|
||||
get(ctx: NextContext, options?: CookieParseOptions): { [key: string]: string };
|
||||
destroy(ctx: NextContext, name: string): void;
|
||||
};
|
||||
|
||||
export default Nookies;
|
||||
@@ -0,0 +1,9 @@
|
||||
import nookies, { parseCookies, setCookie, destroyCookie } from 'nookies';
|
||||
|
||||
nookies.set({ pathname: '', query: {}, asPath: ''}, 'test-cookie', 'test-value');
|
||||
nookies.get({ pathname: '', query: {}, asPath: ''});
|
||||
nookies.destroy({ pathname: '', query: {}, asPath: ''}, 'test-cookie');
|
||||
|
||||
parseCookies({ pathname: '', query: {}, asPath: ''});
|
||||
setCookie({ pathname: '', query: {}, asPath: ''}, 'test-cookie', 'test-value');
|
||||
destroyCookie({ pathname: '', query: {}, asPath: ''}, 'test-cookie');
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"nookies-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user