Add missing property types for styled-jsx (#7154)
This commit is contained in:
parent
78a959bde4
commit
9ce177f987
4 changed files with 101 additions and 93 deletions
|
@ -7,6 +7,7 @@
|
|||
"repository": "zeit/next.js",
|
||||
"bugs": "https://github.com/zeit/next.js/issues",
|
||||
"homepage": "https://nextjs.org",
|
||||
"types": "types/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"app.js",
|
||||
|
@ -34,7 +35,8 @@
|
|||
"router.js",
|
||||
"router.d.ts",
|
||||
"amp.js",
|
||||
"amp.d.ts"
|
||||
"amp.d.ts",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"bin": {
|
||||
"next": "./dist/bin/next"
|
||||
|
|
14
packages/next/types/amp-react.d.ts
vendored
14
packages/next/types/amp-react.d.ts
vendored
|
@ -1,14 +0,0 @@
|
|||
import React from 'react'
|
||||
/**
|
||||
* Types for AMP in React are not available, here we add only the types required for the core
|
||||
*/
|
||||
declare module 'react' {
|
||||
interface HtmlHTMLAttributes<T> extends React.HTMLAttributes<T> {
|
||||
amp?: string;
|
||||
}
|
||||
|
||||
// nonce in <link /> is allowed
|
||||
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
||||
nonce?: string
|
||||
}
|
||||
}
|
91
packages/next/types/index.d.ts
vendored
91
packages/next/types/index.d.ts
vendored
|
@ -1,85 +1,20 @@
|
|||
declare module '@babel/plugin-transform-modules-commonjs';
|
||||
declare module 'next-server/next-config';
|
||||
declare module 'next-server/constants';
|
||||
declare module 'webpack/lib/GraphHelpers';
|
||||
declare module 'unfetch';
|
||||
declare module 'styled-jsx/server';
|
||||
import React from 'react'
|
||||
|
||||
|
||||
declare module 'next/dist/compiled/nanoid/index.js' {
|
||||
function nanoid(size?: number): string;
|
||||
|
||||
export = nanoid;
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/unistore' {
|
||||
import unistore from 'unistore'
|
||||
export = unistore
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/resolve/index.js' {
|
||||
import resolve from 'resolve'
|
||||
|
||||
export = resolve;
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/text-table' {
|
||||
function textTable(rows: Array<Array<{}>>, opts?: {
|
||||
hsep?: string,
|
||||
align?: Array<'l' | 'r' | 'c' | '.'>,
|
||||
stringLength?(str: string): number
|
||||
}): string;
|
||||
|
||||
export = textTable;
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/arg/index.js' {
|
||||
function arg<T extends arg.Spec>(spec: T, options?: {argv?: string[], permissive?: boolean}): arg.Result<T>;
|
||||
|
||||
namespace arg {
|
||||
export type Handler = (value: string) => any;
|
||||
|
||||
export interface Spec {
|
||||
[key: string]: string | Handler | [Handler];
|
||||
}
|
||||
|
||||
export type Result<T extends Spec> = { _: string[] } & {
|
||||
[K in keyof T]: T[K] extends string
|
||||
? never
|
||||
: T[K] extends Handler
|
||||
? ReturnType<T[K]>
|
||||
: T[K] extends [Handler]
|
||||
? Array<ReturnType<T[K][0]>>
|
||||
: never
|
||||
};
|
||||
// Extend the React types with missing properties
|
||||
declare module 'react' {
|
||||
// <html amp=""> support
|
||||
interface HtmlHTMLAttributes<T> extends React.HTMLAttributes<T> {
|
||||
amp?: string;
|
||||
}
|
||||
|
||||
export = arg;
|
||||
}
|
||||
|
||||
declare module 'autodll-webpack-plugin' {
|
||||
import webpack from 'webpack'
|
||||
class AutoDllPlugin implements webpack.Plugin {
|
||||
constructor(settings?: {
|
||||
inject?: boolean,
|
||||
plugins?: webpack.Configuration["plugins"],
|
||||
context?: string,
|
||||
debug?: boolean,
|
||||
filename?: string,
|
||||
path?: string,
|
||||
inherit?: boolean,
|
||||
entry?: webpack.Entry,
|
||||
config?: webpack.Configuration
|
||||
})
|
||||
apply: webpack.Plugin["apply"]
|
||||
[k: string]: any
|
||||
// <link nonce=""> support
|
||||
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
||||
nonce?: string
|
||||
}
|
||||
|
||||
export = AutoDllPlugin
|
||||
}
|
||||
|
||||
declare module NodeJS {
|
||||
interface Process {
|
||||
crossOrigin?: string;
|
||||
// <style jsx> and <style jsx global> support for styled-jsx
|
||||
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
||||
jsx?: boolean;
|
||||
global?: boolean;
|
||||
}
|
||||
}
|
||||
|
|
85
packages/next/types/misc.d.ts
vendored
Normal file
85
packages/next/types/misc.d.ts
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
declare module '@babel/plugin-transform-modules-commonjs';
|
||||
declare module 'next-server/next-config';
|
||||
declare module 'next-server/constants';
|
||||
declare module 'webpack/lib/GraphHelpers';
|
||||
declare module 'unfetch';
|
||||
declare module 'styled-jsx/server';
|
||||
|
||||
|
||||
declare module 'next/dist/compiled/nanoid/index.js' {
|
||||
function nanoid(size?: number): string;
|
||||
|
||||
export = nanoid;
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/unistore' {
|
||||
import unistore from 'unistore'
|
||||
export = unistore
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/resolve/index.js' {
|
||||
import resolve from 'resolve'
|
||||
|
||||
export = resolve;
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/text-table' {
|
||||
function textTable(rows: Array<Array<{}>>, opts?: {
|
||||
hsep?: string,
|
||||
align?: Array<'l' | 'r' | 'c' | '.'>,
|
||||
stringLength?(str: string): number
|
||||
}): string;
|
||||
|
||||
export = textTable;
|
||||
}
|
||||
|
||||
declare module 'next/dist/compiled/arg/index.js' {
|
||||
function arg<T extends arg.Spec>(spec: T, options?: {argv?: string[], permissive?: boolean}): arg.Result<T>;
|
||||
|
||||
namespace arg {
|
||||
export type Handler = (value: string) => any;
|
||||
|
||||
export interface Spec {
|
||||
[key: string]: string | Handler | [Handler];
|
||||
}
|
||||
|
||||
export type Result<T extends Spec> = { _: string[] } & {
|
||||
[K in keyof T]: T[K] extends string
|
||||
? never
|
||||
: T[K] extends Handler
|
||||
? ReturnType<T[K]>
|
||||
: T[K] extends [Handler]
|
||||
? Array<ReturnType<T[K][0]>>
|
||||
: never
|
||||
};
|
||||
}
|
||||
|
||||
export = arg;
|
||||
}
|
||||
|
||||
declare module 'autodll-webpack-plugin' {
|
||||
import webpack from 'webpack'
|
||||
class AutoDllPlugin implements webpack.Plugin {
|
||||
constructor(settings?: {
|
||||
inject?: boolean,
|
||||
plugins?: webpack.Configuration["plugins"],
|
||||
context?: string,
|
||||
debug?: boolean,
|
||||
filename?: string,
|
||||
path?: string,
|
||||
inherit?: boolean,
|
||||
entry?: webpack.Entry,
|
||||
config?: webpack.Configuration
|
||||
})
|
||||
apply: webpack.Plugin["apply"]
|
||||
[k: string]: any
|
||||
}
|
||||
|
||||
export = AutoDllPlugin
|
||||
}
|
||||
|
||||
declare module NodeJS {
|
||||
interface Process {
|
||||
crossOrigin?: string;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue