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.

Expected Behaviour

I wonder why this module doesn’t export any TS interfaces (LoaderOptions).

import { LoaderOptions } from 'ts-loader'

Actual Behaviour

Just js code.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
johnnyreillycommented, Jun 7, 2018

So I think it’s as simple as adding declaration: true to the tsconfig.json. Want to try and report back? If it’s just that then pr with that change and we’re done!

1reaction
Hotellcommented, Jun 7, 2018

Heyo! I have the same problem. I’m using awesome latest TS 2.9 for type checking js files and with that having type safe configs for webpack, jest etc. right now I have to write my own ambient type definitions for interface LoaderOptions

webpack.config.js

// @ts-check

/**
 * @type {Partial<import('ts-loader').LoaderOptions>}
 */
const tsLoaderOptionsRules = {
  configFile: tsConfig,
  transpileOnly: true
}

/**
 * @type {(env:{production?:boolean})=>import('webpack').Configuration}
 */
const config = (env) => {

  return {
    module: {
      rules: [
        {
          include: resolve(__dirname, 'src'),
          test: /\.tsx?$/,
          loader: 'ts-loader',
          options: tsLoaderOptionsRules
        }
      ]
    },
}

instead I would like to use definitions, which you already have in codebase, just need to be shipped as ambient types with your package. I’m definitely up to sending a PR, if you can point me in right direction.

cheers !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handbook - Interfaces - TypeScript
Interfaces are capable of describing the wide range of shapes that JavaScript objects can take. In addition to describing an object with properties,...
Read more >
TypeScript Interfaces - TutorialsTeacher
Interface is a structure that defines the contract in your application. It defines the syntax for classes to follow. Classes that are derived...
Read more >
Understanding and using interfaces in TypeScript
TypeScript has inbuilt support for interfaces. An interface defines the specifications of an entity. It lays out the contract that states what ...
Read more >
TypeScript - Interfaces - Tutorialspoint
An interface is a syntactical contract that an entity should conform to. In other words, an interface defines the syntax that any entity...
Read more >
A Simple Guide to Typescript Interfaces: declaration & use cases
In TypeScript, an interface is an abstract type that tells the compiler which property names a given object can have.
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