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.

Structure of modules in config for typescript

See original GitHub issue

What problem does this feature solve?

This could solve types definition for module options.

Example : When we want load module like @nuxtjs/dotenv with options, we could not have types definition for that options. In code :

import NuxtConfiguration from '@nuxt/config'

const config: NuxtConfiguration = {
  modules: [
    ['@nuxtjs/dotenv', {
      systemvars: true
    }]
  ]
}

export default config

Explain: With that we don’t have error but we don’t have types on systemvars and could not define that types

What does the proposed changes look like?

For that i propose use object for modules.

With could like that :

modules: {
  '@nuxtjs/dotenv': {}, // Without options
  '@nuxtjs/dotenv': { // With options
    systemvars: true
  }
}

And with that on modules we could define types like :

declare module '@nuxt/config/types/module' {
  export interface NuxtConfigurationModuleOptions {
    '@nuxtjs/dotenv': {
      systemvars?: boolean
    }
  }
}
<div align="right">This feature request is available on Nuxt community (#c9373)</div>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
clarkdocommented, Jun 17, 2019

@kevinmarrec @pi0 Remind: As my comment above, the order of module execution needs to be guaranteed.

0reactions
kevinmarreccommented, Aug 28, 2019

Okay thanks @orblazer

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Module Resolution
How TypeScript resolves modules in JavaScript. ... Setting baseUrl informs the compiler where to find modules. All module imports with non-relative names ...
Read more >
Organize code in TypeScript using modules
Modules are a type of design pattern in computer programming used to improve the readability, structure, and testability of code. They are ...
Read more >
A TypeScript Project Structure Guide
Directory Structure, Module Resolution and Related Configuration Options · General tsconfig. · Output Options # · “package. · Initial Implementation ...
Read more >
How To Use Modules in TypeScript
TypeScript offers support for creating and using modules with a unified syntax that is similar to the ES Module syntax, while allowing the ......
Read more >
Setting up your TypeScript environment - ArcGIS Developers
compilerOptions.module - This is the module system used to compile the code. In this example we are compiling the output as ES modules...
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