【发布时间】:2020-12-09 08:48:30
【问题描述】:
我有一个 TypeScript 错误 TS1128:需要声明或声明。我花了几个小时,我找不到错误...它在 master/node_modules/@theme-ui/core/dist/index.d.ts (4, 1) 中:
import * as React from 'react';
import './react-jsx';
export type { CSSObject, CSSOthersObject, CSSProperties, CSSPseudoSelectorProps, ColorMode, ColorModesScale, Label, ResponsiveStyleValue, Scale, StylePropertyValue, TLengthStyledSystem, Theme, ThemeDerivedStyles, ThemeStyles, ThemeUICSSObject, ThemeUICSSProperties, ThemeUIExtendedCSSProperties, ThemeUIStyleObject, VariantProperty, } from '@theme-ui/css';
export * from './types';
export declare const jsx: typeof React.createElement;
export interface ContextValue {
__EMOTION_VERSION__: string;
theme: Theme;
}
export declare const Context: React.Context<ContextValue>;
export declare const useThemeUI: () => ContextValue;
/**
* Deeply merge themes
*/
export declare const merge: {
(a: Theme, b: Theme): Theme;
all: typeof mergeAll;
}
declare function mergeAll<A, B>(a: A, B: B): A & B;
declare function mergeAll<A, B, C>(a: A, B: B, c: C): A & B & C;
declare function mergeAll<A, B, C, D>(a: A, B: B, c: C, d: D): A & B & C & D;
interface BaseProviderProps {
context: ContextValue;
}
export interface ThemeProviderProps {
theme: Theme | ((outerTheme: Theme) => Theme);
children?: React.ReactNode;
}
export declare function ThemeProvider({ theme, children }: ThemeProviderProps): React.FunctionComponentElement<BaseProviderProps>;
【问题讨论】:
-
您可能应该告诉 typescript 完全忽略您的 node_modules 文件夹。没有理由检查您无法解决的问题。如果它发生在特定的外部依赖项中,您可以在托管项目的 git 存储库中提交问题(或拉取请求以修复它)。检查
node_modules/theme-ui/package.json文件以找到它。
标签: reactjs typescript build-error