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.

Suggestion: an option to make --showConfig more verbose

See original GitHub issue

Search Terms

showConfig, verbose, verbosity

Suggestion

Currently, the --showConfig option will only print the compiler options that are provided by the given tsconfig.json.

The suggestion is to introduce another command line option to use together with --showConfig, for example --verbose, that would additionally print out the default values of all of the missing compiler options.

Use Cases

This new option hopes to make debugging configuration files easier by explicitly displaying the value of every compiler option.

Examples

Given the following folder structure:

.
├── main.ts
└── tsconfig.json

And the following tsconfig.json:

{
  "compilerOptions": {
    "target": "es5"
  },
  "include": ["**/*.ts"]
}

Running the command tsc --showConfig produces:

{
    "compilerOptions": {
        "target": "es5"
    },
    "files": [
        "./main.ts"
    ],
    "include": [
        "**/*.ts"
    ]
}

Here’s an example output of tsc --showConfig --verbose. It was derived in the following way:

  1. Use the Typescript Handbook’s table of compiler options and their defaults as a reference.
  2. Exclude deprecated options (out, reactNamespace, and skipDefaultLibCheck)
  3. Also exclude any options that are missing a default value in the table, since JSON doesn’t have a notion of undefined.
{
    "compilerOptions": {
        "allowJs": false,
        "allowSyntheticDefaultImports": false,
        "allowUmdGlobalAccess": false,
        "allowUnreachableCode": false,
        "allowUnusedLabels": false,
        "alwaysStrict": false,
        "build": false,
        "charset": "utf8",
        "checkJs": false,
        "composite": true,
        "declaration": false,
        "declarationMap": false,
        "diagnostics": false,
        "disableSizeLimit": false,
        "downlevelIteration": false,
        "emitBOM": false,
        "emitDeclarationOnly": false,
        "emitDecoratorMetadata": false,
        "esModuleInterop": false,
        "experimentalDecorators": false,
        "extendedDiagnostics": false,
        "forceConsistentCasingInFileNames": false,
        "importHelpers": false,
        "incremental": false,
        "inlineSourceMap": false,
        "inlineSources": false,
        "isolatedModules": false,
        "jsx": "preserve",
        "jsxFactory": "React.createElement",
        "keyofStringsOnly": false,
        "listEmittedFiles": false,
        "listFiles": false,
        "locale": "en", // [2]
        "module": "commonjs",
        "moduleResolution": "classic",
        "newLine": "lf", // [2]
        "noEmit": false,
        "noEmitHelpers": false,
        "noEmitOnError": false,
        "noErrorTruncation": false,
        "noFallthroughCasesInSwitch": false,
        "noImplicitAny": false,
        "noImplicitReturns": false,
        "noImplicitThis": false,
        "noImplicitUseStrict": false,
        "noLib": false,
        "noResolve": false,
        "noStrictGenericChecks": false,
        "noUnusedLocals": false,
        "noUnusedParameters": false,
        "preserveConstEnums": false,
        "preserveSymlinks": false,
        "preserveWatchOutput": false,
        "pretty": true, // [1]
        "removeComments": false,
        "resolveJsonModule": false,
        "rootDir": "(computed from the list of input files)", // [3]
        "showConfig": false,
        "skipLibCheck": false,
        "sourceMap": false,
        "strict": false,
        "strictBindCallApply": false,
        "strictFunctionTypes": false,
        "strictPropertyInitialization": false,
        "strictNullChecks": false,
        "suppressExcessPropertyErrors": false,
        "suppressImplicitAnyIndexErrors": false,
        "target": "es5",
        "traceResolution": false,
        "tsBuildInfoFile": ".tsbuildinfo"
    },
    "files": [
        "./main.ts"
    ],
    "include": [
        "**/*.ts"
    ]
}

[1] The Handbook says pretty should be true unless piping or redirecting output to file, so the desired value here may be ambiguous?

[2] locale and newLine are platform-specific.

[3] rootDir would need to be calculated so it can be displayed.

Checklist

My suggestion meets these guidelines:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:21
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
sandersncommented, Sep 4, 2019

Maybe this is how showConfig should behave all the time?

4reactions
fatcerberuscommented, Sep 5, 2019

Yes. If I want to see only what’s in the tsconfig, there’s already cat. --showConfig would be more useful if it showed the effective config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cisco IOS Configuration Fundamentals Command Reference
Specifies a search at a --More-- prompt that begins unfiltered output with the first line that contains the regular expression.
Read more >
Setting GitVersion for prerelease - Stack Overflow
I want to make the initial releases 'prerelease' (building through AppVeyor off of the master branch). I used gitversion init to generate the ......
Read more >
Terminal IPython options — IPython 8.7.0 documentation
Dotted module name(s) of one or more IPython extensions to load. For specifying extra extensions to load on the command-line.
Read more >
HTML Tidy / Feature Requests / #9 Show config files/options actually ...
specified from the command line, or even a config file?) to control this feature, as the dump could get verbose. I would suggest...
Read more >
Ubuntu Manpage: postfwd - postfix firewall daemon
-C, --showconfig shows ruleset summary, -v for verbose -L, ... Set the option twice (-vv) to get more information (logs all request attributes)....
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