未验证 提交 f17d78f8 编写于 作者: M Maxi Gimenez 提交者: GitHub

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

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