Unverified Commit f17d78f8 authored by Maxi Gimenez's avatar Maxi Gimenez Committed by GitHub

chore(next): export/lib/next-server missing types (#13320)

parent 82dfe157
...@@ -90,7 +90,7 @@ export default async function ( ...@@ -90,7 +90,7 @@ export default async function (
options: any, options: any,
configuration?: any configuration?: any
): Promise<void> { ): Promise<void> {
function log(message: string) { function log(message: string): void {
if (options.silent) { if (options.silent) {
return return
} }
......
...@@ -23,7 +23,7 @@ export async function recursiveCopy( ...@@ -23,7 +23,7 @@ export async function recursiveCopy(
const sema = new Sema(concurrency) const sema = new Sema(concurrency)
async function _copy(item: string) { async function _copy(item: string): Promise<void> {
const target = item.replace(from, to) const target = item.replace(from, to)
const stats = await promises.stat(item) const stats = await promises.stat(item)
......
...@@ -30,7 +30,7 @@ async function checkDependencies({ ...@@ -30,7 +30,7 @@ async function checkDependencies({
}: { }: {
dir: string dir: string
isYarn: boolean isYarn: boolean
}) { }): Promise<string> {
const requiredPackages = [ const requiredPackages = [
{ file: 'typescript', pkg: 'typescript' }, { file: 'typescript', pkg: 'typescript' },
{ file: '@types/react/index.d.ts', pkg: '@types/react' }, { file: '@types/react/index.d.ts', pkg: '@types/react' },
......
...@@ -5,11 +5,11 @@ export function isInAmpMode({ ...@@ -5,11 +5,11 @@ export function isInAmpMode({
ampFirst = false, ampFirst = false,
hybrid = false, hybrid = false,
hasQuery = false, hasQuery = false,
} = {}) { } = {}): boolean {
return ampFirst || (hybrid && hasQuery) return ampFirst || (hybrid && hasQuery)
} }
export function useAmp() { export function useAmp(): boolean {
// Don't assign the context value to a variable to save bytes // Don't assign the context value to a variable to save bytes
return isInAmpMode(React.useContext(AmpStateContext)) return isInAmpMode(React.useContext(AmpStateContext))
} }
...@@ -52,7 +52,7 @@ export type LoadableComponent<P = {}> = React.ComponentType<P> ...@@ -52,7 +52,7 @@ export type LoadableComponent<P = {}> = React.ComponentType<P>
export function noSSR<P = {}>( export function noSSR<P = {}>(
LoadableInitializer: LoadableFn<P>, LoadableInitializer: LoadableFn<P>,
loadableOptions: LoadableOptions<P> loadableOptions: LoadableOptions<P>
) { ): React.ComponentType<P> {
// Removing webpack and modules means react-loadable won't try preloading // Removing webpack and modules means react-loadable won't try preloading
delete loadableOptions.webpack delete loadableOptions.webpack
delete loadableOptions.modules delete loadableOptions.modules
......
...@@ -8,7 +8,7 @@ type WithInAmpMode = { ...@@ -8,7 +8,7 @@ type WithInAmpMode = {
inAmpMode?: boolean inAmpMode?: boolean
} }
export function defaultHead(inAmpMode = false) { export function defaultHead(inAmpMode = false): JSX.Element[] {
const head = [<meta charSet="utf-8" />] const head = [<meta charSet="utf-8" />]
if (!inAmpMode) { if (!inAmpMode) {
head.push(<meta name="viewport" content="width=device-width" />) head.push(<meta name="viewport" content="width=device-width" />)
......
...@@ -4,6 +4,6 @@ export default () => { ...@@ -4,6 +4,6 @@ export default () => {
return runtimeConfig return runtimeConfig
} }
export function setConfig(configValue: any) { export function setConfig(configValue: any): void {
runtimeConfig = configValue runtimeConfig = configValue
} }
...@@ -17,7 +17,7 @@ export default () => { ...@@ -17,7 +17,7 @@ export default () => {
const mountedInstances: Set<any> = new Set() const mountedInstances: Set<any> = new Set()
let state: State let state: State
function emitChange(component: React.Component<SideEffectProps>) { function emitChange(component: React.Component<SideEffectProps>): void {
state = component.props.reduceComponentsToState( state = component.props.reduceComponentsToState(
[...mountedInstances], [...mountedInstances],
component.props component.props
......
...@@ -347,7 +347,7 @@ export const urlObjectKeys = [ ...@@ -347,7 +347,7 @@ export const urlObjectKeys = [
export function formatWithValidation( export function formatWithValidation(
url: UrlObject, url: UrlObject,
options?: URLFormatOptions options?: URLFormatOptions
) { ): string {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
if (url !== null && typeof url === 'object') { if (url !== null && typeof url === 'object') {
Object.keys(url).forEach((key) => { Object.keys(url).forEach((key) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment