New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@types/next

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/next - npm Package Compare versions

Comparing version 6.1.6 to 6.1.7

45

next/app.d.ts
import * as React from "react";
import { NextContext } from ".";
import { NextContext, NextComponentType } from ".";
import { RouterProps, DefaultQuery } from "./router";
export interface AppComponentProps<Q = DefaultQuery> {
Component: React.ComponentType<any>;
// Deprecated
export type AppComponentProps = AppProps;
export type AppComponentContext = NextAppContext;
// End Deprecated
/**
* Context passed to App.getInitialProps.
* Component is dynamic - cannot infer type.
*
* @template Q Query object schema.
*/
export interface NextAppContext<Q = DefaultQuery> {
Component: NextComponentType<any, any, NextContext<Q>>;
router: RouterProps<Q>;
pageProps: any;
ctx: NextContext<Q>;
}
export interface AppComponentContext<Q = DefaultQuery> {
Component: React.ComponentType<any>;
/**
* Props passed to the App component.
* Component and pageProps are dynamic - cannot infer type.
*
* @template Q Query object schema.
*/
export interface AppProps<Q = DefaultQuery> {
Component: NextComponentType<any, any, NextContext<Q>>;
router: RouterProps<Q>;
ctx: NextContext<Q>;
pageProps: any;
}
export class Container extends React.Component { }
/**
* App component type. Differs from the default type because the context it passes
* to getInitialProps and the props is passes to the component are different.
*
* @template IP Initial props returned from getInitialProps.
* @template C Context passed to getInitialProps.
*/
export type AppComponentType<IP = {}, C = NextAppContext> = NextComponentType<IP & AppProps, IP, C>;
export default class App<TProps = {}, Q = DefaultQuery> extends React.Component<TProps & AppComponentProps<Q>> { }
export class Container extends React.Component {}
export default class App<IP = {}, C = NextAppContext> extends React.Component<IP & AppProps> {
getInitialProps(context: C): Promise<IP> | IP;
}

47

next/document.d.ts
import * as React from "react";
import { NextContext, NextComponentType } from ".";
import { DefaultQuery } from "./router";
import { NextContext } from ".";
export interface RenderPageResponse {

@@ -24,12 +24,21 @@ buildManifest: { [key: string]: any };

export type Enhancer<E extends PageProps = AnyPageProps, P extends any = E> = (page: React.ComponentType<P>) => React.ComponentType<E>;
export type Enhancer<E extends PageProps = AnyPageProps, P extends any = E> = (
page: React.ComponentType<P>
) => React.ComponentType<E>;
/**
* Context object used inside `Document`
* Context passed to Document.getInitialProps.
*
* @template Q Query object schema.
*/
export interface NextDocumentContext extends NextContext {
export interface NextDocumentContext<Q = DefaultQuery> extends NextContext<Q> {
/** A callback that executes the actual React rendering logic (synchronously) */
renderPage<E extends PageProps = AnyPageProps, P extends any = E>(enhancer?: Enhancer<E, P>): RenderPageResponse; // tslint:disable-line:no-unnecessary-generics
renderPage<E extends PageProps = AnyPageProps, P extends any = E>(
enhancer?: Enhancer<E, P> // tslint:disable-line no-unnecessary-generics
): RenderPageResponse;
}
/**
* Props passed to the Document component.
*/
export interface DocumentProps {

@@ -49,2 +58,5 @@ __NEXT_DATA__?: any;

/**
* Props supported by the Head component.
*/
export interface HeadProps {

@@ -55,11 +67,30 @@ nonce?: string;

/**
* Props supported by the NextScript component.
*/
export interface NextScriptProps {
nonce?: string;
[key: string]: any;
}
/**
* Document component type. Differs from the default type because the context it passes
* to getInitialProps and the props is passes to the component are different.
*
* @template IP Initial props returned from getInitialProps.
* @template C Context passed to getInitialProps.
*/
export type DocumentComponentType<IP = {}, C = NextDocumentContext> = NextComponentType<
IP & DocumentProps,
IP,
C
>;
export class Head extends React.Component<HeadProps> {}
export class Main extends React.Component {}
export class NextScript extends React.Component<NextScriptProps> {}
export default class Document<TProps = {}> extends React.Component<TProps & DocumentProps> {
static getInitialProps(ctx: NextDocumentContext): Promise<DocumentProps> | DocumentProps;
export default class Document<IP = {}, C = NextDocumentContext> extends React.Component<
IP & DocumentProps
> {
getInitialProps(context: C): Promise<IP> | IP;
}

@@ -19,3 +19,3 @@ // Type definitions for next 6.1

import { SingletonRouter, DefaultQuery } from './router';
import { SingletonRouter, DefaultQuery } from "./router";

@@ -25,3 +25,7 @@ declare namespace next {

type QueryStringMapObject = DefaultQuery;
type ServerConfig = NextConfig;
// End Deprecated
type UrlLike = url.UrlObject | url.Url;
/**

@@ -31,2 +35,4 @@ * Context object used in methods like `getInitialProps()`

* https://github.com/zeit/next.js/blob/6.1.1/readme.md#fetching-data-and-component-lifecycle
*
* @template Q Query object schema.
*/

@@ -50,10 +56,2 @@ interface NextContext<Q = DefaultQuery> {

type NextSFC<TProps = {}, Q = DefaultQuery> = NextStatelessComponent<TProps, Q>;
interface NextStatelessComponent<TProps = {}, Q = DefaultQuery>
extends React.StatelessComponent<TProps> {
getInitialProps?: (ctx: NextContext<Q>) => Promise<TProps>;
}
type UrlLike = url.UrlObject | url.Url;
/**

@@ -63,3 +61,3 @@ * Next.js config schema.

*/
interface ServerConfig {
interface NextConfig {
webpack?: any;

@@ -91,3 +89,3 @@ webpackDevMiddleware?: any;

quiet?: boolean;
conf?: ServerConfig;
conf?: NextConfig;
}

@@ -106,3 +104,3 @@

http: null | http.Server;
nextConfig: ServerConfig;
nextConfig: NextConfig;
distDir: string;

@@ -124,3 +122,3 @@ buildId: string;

dir: string,
options: { quiet: boolean; config: ServerConfig; buildId: string }
options: { quiet: boolean; config: NextConfig; buildId: string }
): any;

@@ -143,7 +141,3 @@ handleRequest(

start(): Promise<void>;
run(
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl: UrlLike
): Promise<void>;
run(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): Promise<void>;

@@ -194,2 +188,45 @@ render(

}
/**
* Next.js counterpart of React.ComponentType.
* Specially useful in HOCs that receive Next.js components.
*
* @template P Component props.
* @template IP Initial props returned from getInitialProps.
* @template C Context passed to getInitialProps.
*/
type NextComponentType<P = {}, IP = P, C = NextContext> =
| NextComponentClass<P, IP, C>
| NextStatelessComponent<P, IP, C>;
/**
* Next.js counterpart of React.SFC/React.StatelessComponent.
*
* @template P Component props.
* @template IP Initial props returned from getInitialProps.
* @template C Context passed to getInitialProps.
*/
type NextSFC<P = {}, IP = P, C = NextContext> = NextStatelessComponent<P, IP, C>;
type NextStatelessComponent<P = {}, IP = P, C = NextContext> = React.StatelessComponent<P> &
NextStaticLifecycle<IP, C>;
/**
* Next.js counterpart of React.ComponentClass.
*
* @template P Component props.
* @template IP Initial props returned from getInitialProps.
* @template C Context passed to getInitialProps.
*/
type NextComponentClass<P = {}, IP = P, C = NextContext> = React.ComponentClass<P> &
NextStaticLifecycle<IP, C>;
/**
* Next.js specific lifecycle methods.
*
* @template IP Initial props returned from getInitialProps and passed to the component.
* @template C Context passed to getInitialProps.
*/
interface NextStaticLifecycle<IP, C> {
getInitialProps?: (ctx: C) => Promise<IP> | IP;
}
}

@@ -196,0 +233,0 @@

{
"name": "@types/next",
"version": "6.1.6",
"version": "6.1.7",
"description": "TypeScript definitions for next",

@@ -49,4 +49,4 @@ "license": "MIT",

},
"typesPublisherContentHash": "2381e73323604a385b7433276791ff3620b8995e6f6bb64bd7a524e6113fb633",
"typesPublisherContentHash": "48ead1919210c3fc430baea8c436f779288a72dd0ff8921ae025de34a45c9530",
"typeScriptVersion": "2.8"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Mon, 17 Sep 2018 19:34:38 GMT
* Last updated: Thu, 20 Sep 2018 23:55:07 GMT
* Dependencies: react, url, http, node-fetch, node

@@ -14,0 +14,0 @@ * Global values: none

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc