Skip to content

tsconfig exclude still auto imports #34666

@hvonralvert

Description

@hvonralvert

Typescript 3.5.3
Angular 8.2.11
Firebase 7.2.1

We recently installed Firebase into our app (have filed an issue there as well)

They have an file that exports undefined. Now Auto Import will allways import "undefined" from this file. This gives a bad developer experience that it imports this whenever someone presses tab when writing "undefined".

The Auto import :
import undefined = require('firebase/empty-import');

We have tried to exclude this import in tsconfig.json and tsconfig.app.json

tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "baseUrl": "./src",
    "paths": {
      "~/*": [ "*" ],
      "@exp/structure/pages/*": ["app/structure/pages/*"],
      "@exp/services/*": ["app/shared/services/*"],
      "@exp/modals/*": ["app/shared/modals/*"],
      "@exp/components/*": ["app/shared/components/*"],
      "@exp/dropdowns/*": ["app/shared/dropdowns/*"],
      "@exp/old/*": ["shared/*"],
    },
  },
  "exclude": [
    "node_modules/firebase/empty-import",
    "node_modules/firebase/empty-import.d.ts",
    "firebase/empty-import.d.ts"
  ],
  "angularCompilerOptions": {
    "enableIvy": false
  }
}

tsconfig.app.json:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "test.ts",
    "**/*.spec.ts",
    "src/**/*.worker.ts",
    "node_modules/firebase/empty-import",
    "node_modules/firebase/**/*",
    "firebase/empty-import",
    "node_modules/firebase/empty-import.d.ts",
    "firebase/empty-import.d.ts"
  ]
}

The problematic file from Firebase's library:
import undefined = require('firebase/empty-import');:

/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

export = undefined;

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions