Skip to content

[Bug]: Type of sass-loader additionalData function is wrong #2582

@Atmos4

Description

@Atmos4

Version

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 10.88 GB / 31.68 GB
  Browsers:
    Edge: Chromium (125.0.2535.92)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @rsbuild/core: ^0.7.6 => 0.7.6
    @rsbuild/plugin-react: ^0.7.6 => 0.7.6
    @rsbuild/plugin-sass: ^0.7.6 => 0.7.6

Details

The type of additionalData function of sass plugin is

type Callback<T> = (loaderContext: Webpack.loader.LoaderContext) => T;

However, there is supposed to be a content argument:

// This is what the type is supposed to be
type Callback<T> = (content: string, loaderContext: Webpack.loader.LoaderContext) => T;

Which one is right? I can do a PR if you confirm that this is just a type error.
If this is not the type error, how can I get the content and manipulate it?

Reproduce link

https://www.google.com/search?q=no+need+for+a+url+the+issue+is+self+explanatory

Reproduce Steps

  1. try to use the content argument from the additionalData function of pluginSass.
  2. get a slap from Typescript, because it's not a string type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions