Fix @next/mdx types (#57580)
It’s not possible to combine `export =` type definitions with ESM-style exports. To export types for a module that uses `module.exports =`, one needs to use a namespace. Also `Options` is now imported from `@mdx-js/loader`. The imports need to come from a direct dependency or peer dependency. Also `@mdx-js/loader` is more accurate here, because the options are passed into `@mdx-js/loader`. --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
This commit is contained in:
parent
b4db808822
commit
d407a016c0
1 changed files with 22 additions and 22 deletions
44
packages/next-mdx/index.d.ts
vendored
44
packages/next-mdx/index.d.ts
vendored
|
@ -1,33 +1,33 @@
|
|||
/* eslint-disable */
|
||||
import { NextConfig } from 'next'
|
||||
import { CompileOptions } from '@mdx-js/mdx'
|
||||
import { RuleSetConditionAbsolute } from 'webpack'
|
||||
import type { NextConfig } from 'next'
|
||||
import type { Options } from '@mdx-js/loader'
|
||||
import type { RuleSetConditionAbsolute } from 'webpack'
|
||||
|
||||
type WithMDX = (config: NextConfig) => NextConfig
|
||||
|
||||
export interface NextMDXOptions {
|
||||
/**
|
||||
* A webpack rule test to match files to treat as MDX.
|
||||
*
|
||||
* @default /\.mdx$/
|
||||
* @example
|
||||
* // Support both .md and .mdx files.
|
||||
* /\.mdx?$/
|
||||
*/
|
||||
extension?: RuleSetConditionAbsolute
|
||||
declare namespace nextMDX {
|
||||
interface NextMDXOptions {
|
||||
/**
|
||||
* A webpack rule test to match files to treat as MDX.
|
||||
*
|
||||
* @default /\.mdx$/
|
||||
* @example
|
||||
* // Support both .md and .mdx files.
|
||||
* /\.mdx?$/
|
||||
*/
|
||||
extension?: RuleSetConditionAbsolute
|
||||
|
||||
/**
|
||||
* The options to pass to MDX.
|
||||
*
|
||||
* @see https://mdxjs.com/packages/mdx/#api
|
||||
*/
|
||||
options?: CompileOptions
|
||||
/**
|
||||
* The options to pass to MDX.
|
||||
*
|
||||
* @see https://mdxjs.com/packages/mdx/#api
|
||||
*/
|
||||
options?: Options
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use [MDX](https://github.com/mdx-js/mdx) with [Next.js](https://github.com/vercel/next.js)
|
||||
*/
|
||||
declare function nextMDX(options?: NextMDXOptions): WithMDX
|
||||
declare function nextMDX(options?: nextMDX.NextMDXOptions): WithMDX
|
||||
|
||||
export = nextMDX
|
||||
/* eslint=enable */
|
||||
|
|
Loading…
Reference in a new issue