找不到模块的声明文件。

发布于 2025-02-12 14:27:43 字数 421 浏览 1 评论 0原文

我在尝试使用样式的组件v5.3.5创建全局样式时会有此错误。你们可以在这里帮我吗?

import { createGlobalStyle } from "styled-components";

export const GlobalStyle = createGlobalStyle`
    :root {
        --background: #f0f2f5;
    }

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        background-color: var(--background);
        -webkit-font-smoothing: antialiesed;
    }
`;

im having this error when trying to create a global style using styled components v5.3.5. Can you guys help me here please?

import { createGlobalStyle } from "styled-components";

export const GlobalStyle = createGlobalStyle`
    :root {
        --background: #f0f2f5;
    }

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        background-color: var(--background);
        -webkit-font-smoothing: antialiesed;
    }
`;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落花随流水 2025-02-19 14:27:43

该错误应通过

解决
npm I -D @types/stypled -components @最新

This error should be resolved with

npm i -D @types/styled-components@latest

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文