Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/458.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我不能在另一个模块中使用我的.d.ts文件,模块有问题_Javascript_Typescript_Next.js - Fatal编程技术网

Javascript 我不能在另一个模块中使用我的.d.ts文件,模块有问题

Javascript 我不能在另一个模块中使用我的.d.ts文件,模块有问题,javascript,typescript,next.js,Javascript,Typescript,Next.js,我在将.d.ts文件链接到另一个.d.ts文件时遇到问题。它返回以下错误: 模块“./consts”没有导出的成员“设备”。你是说 “设备” 我试图找出TS文档中缺少的内容,但没有找到答案。我用导出的const设备得到了同一个名为const.ts的文件 我的代码如下所示: 常数d.ts declare module "@utils/Queries/consts" export type Devices = 'xs' | 'sm' | 'md' | 'lg' | 'xl'

我在将.d.ts文件链接到另一个.d.ts文件时遇到问题。它返回以下错误:

模块“./consts”没有导出的成员“设备”。你是说 “设备”

我试图找出TS文档中缺少的内容,但没有找到答案。我用导出的const设备得到了同一个名为const.ts的文件

我的代码如下所示:

常数d.ts

declare module "@utils/Queries/consts"

export type Devices = 'xs' | 'sm' | 'md' | 'lg' | 'xl'

declare const QUERIES: {
  XS: 'xs',
  SM: 'sm',
  MD: 'md',
  LG: 'lg',
  XL: 'xl'
}
import { Interpolation } from 'styled-components'

import { Devices } from './consts'

declare module '@utils/Queries/query'

type QueryFunction = (style: Interpolation<any>) => Interpolation<any>

declare const MediaQuery: { [key in Devices]: QueryFunction };
declare const getBreakpointWidth: (name: string) => string;

export { MediaQuery, MediaQuery as default, getBreakpointWidth };
现在我想调用index.d.ts中的设备类型,我得到了上面写的错误

索引d.ts

declare module "@utils/Queries/consts"

export type Devices = 'xs' | 'sm' | 'md' | 'lg' | 'xl'

declare const QUERIES: {
  XS: 'xs',
  SM: 'sm',
  MD: 'md',
  LG: 'lg',
  XL: 'xl'
}
import { Interpolation } from 'styled-components'

import { Devices } from './consts'

declare module '@utils/Queries/query'

type QueryFunction = (style: Interpolation<any>) => Interpolation<any>

declare const MediaQuery: { [key in Devices]: QueryFunction };
declare const getBreakpointWidth: (name: string) => string;

export { MediaQuery, MediaQuery as default, getBreakpointWidth };