question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poor webpack own typings detalization

See original GitHub issue

Bug report

What is the current behavior?

Loader from webpack/declarations/WebpackOptions

export interface Loader {
	[k: string]: any;
}

Loader from @types/webpack

interface Loader extends Function {
            (this: LoaderContext, source: string | Buffer, sourceMap?: RawSourceMap): string | Buffer | void | undefined;

            /**
             * The order of chained loaders are always called from right to left.
             * But, in some cases, loaders do not care about the results of the previous loader or the resource.
             * They only care for metadata. The pitch method on the loaders is called from left to right before the loaders are called (from right to left).
             * If a loader delivers a result in the pitch method the process turns around and skips the remaining loaders,
             * continuing with the calls to the more left loaders. data can be passed between pitch and normal call.
             */
            pitch?(remainingRequest: string, precedingRequest: string, data: any): any;

            /**
             * By default, the resource file is treated as utf-8 string and passed as String to the loader.
             * By setting raw to true the loader is passed the raw Buffer.
             * Every loader is allowed to deliver its result as String or as Buffer.
             * The compiler converts them between loaders.
             */
            raw?: boolean;
        }

Quite big difference)

As I understand, own types are not so detailed, as in @types/webpack But It will be nice to have the same typings with the same detalization.

Other relevant information: webpack version: beta 15 Node.js version: 10.xxx Operating System: windows

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
artem-malkocommented, May 29, 2020

There is a temp solution, who want to use webpack beta 15 and rich typings from @types/webpack: tsconfig.json

"compilerOptions": {
    "paths": {
      "webpack": ["./node_modules/@types/webpack/index.d.ts"],
    },
}
1reaction
alexander-akaitcommented, Oct 11, 2020

Let’s close in favor https://github.com/webpack/webpack/issues/11630, we need some more types for loader(s)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom typing definitions file is ignored after Upgrade to ...
I've got the same issue when I migrate to Angular 9. I fix it just adding typings.d.ts in your tsconfig.app.json { "extends": "....
Read more >
webpack-typings-aliases-plugin - npm package - Snyk
webpack -typings-aliases-plugin. v0.0.10. Resolves typings aliases for typescript For more information about how to use this package see README.
Read more >
Using webpack with TypeScript - LogRocket Blog
Learn how to use webpack to compile TypeScript to JavaScript and bundle source code into a single JavaScript file.
Read more >
The Right Usage of Aliases in Webpack and TypeScript
Today I want to share some tips with you to improve your projects and make it much easier to maintain. I'm talking about...
Read more >
Using Typescript - WorkAdventure
Below is a step by step guide explaining how to set up Typescript + Webpack along your WorkAdventure map. In your map directory,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found