Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaration for interface-only file not generated in watch mode #163

Closed
ahramadan opened this issue Jul 24, 2019 · 2 comments
Closed

Declaration for interface-only file not generated in watch mode #163

ahramadan opened this issue Jul 24, 2019 · 2 comments
Labels
kind: bug Something isn't working properly topic: type-only / emit-less imports Related to importing type-only files that will not be emitted

Comments

@ahramadan
Copy link

ahramadan commented Jul 24, 2019

What happens and why it is wrong

Source file with only type declarations ex: Interfaces don't get declarations generated in watch mode.

The plugin is watching watching: project/packages/data-switch/DataSwitch.ts for changes
but not generating new declaration files when the file changes.

The file contains only export interface definitions.

Environment

Linux Env.

Versions

  • typescript: 3.5
  • rollup: 1.17.0
  • rollup-plugin-typescript2: 0.21.2

rollup.config.js

import resolve from 'rollup-plugin-node-resolve';
import ts from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import commonjs from "rollup-plugin-commonjs";
import path from 'path';



/*
Resolve paths under node modules
*/
const extensions = ['.ts', '.js'];
const nodeResolveOptions = {
    extensions
};

/*
Resolve commonjs modules as es6 modules
*/
const commonjsOptions = {
    include: /node_modules/
};

/*
Typescript transpiler options
to debug raise the verbosity to 3
*/
const typescriptOptions = {
    verbosity:3,
    clean:true,
    typescript,
    useTsconfigDeclarationDir:true
};

export default {
    input: 'index.ts',
    onwarn,
    output: [
      {
        file:pkg.main,
        format:"umd",
        name : libraryName,
        exports: "named",
        sourcemap: true,
        interop: true,
        globals: knownGlobals
      },
      {
        file: pkg.module,
        format: 'es',
        exports: "named",
        sourcemap: true,
        interop: true,
        globals: knownGlobals,
        /*paths: {
          handlebars: './handlebars.js'
        }*/
      }
    ],
    external:externals,
  plugins: [
    resolve(nodeResolveOptions),
    commonjs(commonjsOptions),
    ts(typescriptOptions)
    ]
};

tsconfig.json

{
    "extends":"../../tsconfig",
    "include": [
        "./**/*.ts"
    ],
    "compilerOptions": {
        "declarationDir": "./dist"
    }
}

extends

{
    "exclude": [
        "**/node_modules/",
        "**/dist/"
    ],
    "compilerOptions": {
        "lib": ["dom","es6"],
        "noImplicitAny": true,
        "module": "es6",
        "target": "es5",
        "declaration": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports":true,
        "sourceMap": true,
        "moduleResolution": "node"
    }
}

plugin output with verbosity 3

rollup v1.17.0
bundles index.ts → dist/index.js, dist/index.es.js...
rpt2: built-in options overrides: {
    "noEmitHelpers": false,
    "importHelpers": true,
    "noResolve": false,
    "noEmit": false,
    "inlineSourceMap": false,
    "outDir": "project/packages/data-switch/.rpt2_cache/placeholder",
    "moduleResolution": 2,
    "allowNonTsExtensions": true
}
rpt2: parsed tsconfig: {
    "options": {
        "lib": [
            "lib.dom.d.ts",
            "lib.es2015.d.ts"
        ],
        "noImplicitAny": true,
        "module": 5,
        "target": 1,
        "declaration": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "sourceMap": true,
        "moduleResolution": 2,
        "declarationDir": "project/packages/data-switch/dist",
        "configFilePath": "project/packages/data-switch/tsconfig.json",
        "noEmitHelpers": false,
        "importHelpers": true,
        "noResolve": false,
        "noEmit": false,
        "inlineSourceMap": false,
        "outDir": "project/packages/data-switch/.rpt2_cache/placeholder",
        "allowNonTsExtensions": true
    },
    "fileNames": [
        "project/packages/data-switch/DataSwitch.ts",
        "project/packages/data-switch/DataSwitchComponent.test.ts",
        "project/packages/data-switch/DataSwitchComponent.ts",
        "project/packages/data-switch/PickerValidator.ts",
        "project/packages/data-switch/hbs.d.ts",
        "project/packages/data-switch/index.ts"
    ],
    "typeAcquisition": {
        "enable": false,
        "include": [],
        "exclude": []
    },
    "raw": {
        "extends": "../../tsconfig",
        "include": [
            "./**/*.ts"
        ],
        "compilerOptions": {
            "declarationDir": "./dist"
        },
        "compileOnSave": false,
        "exclude": [
            "../../**/node_modules/",
            "../../**/dist/"
        ]
    },
    "errors": [],
    "wildcardDirectories": {
        "project/packages/data-switch": 1
    },
    "compileOnSave": false,
    "configFileSpecs": {
        "includeSpecs": [
            "./**/*.ts"
        ],
        "excludeSpecs": [
            "../../**/node_modules/",
            "../../**/dist/"
        ],
        "validatedIncludeSpecs": [
            "./**/*.ts"
        ],
        "validatedExcludeSpecs": [
            "../../**/node_modules/",
            "../../**/dist/"
        ],
        "wildcardDirectories": {
            "project/packages/data-switch": 1
        }
    }
}
rpt2: included:
[
    "*.ts+(|x)",
    "**/*.ts+(|x)"
]
rpt2: excluded:
[
    "*.d.ts",
    "**/*.d.ts"
]
rpt2: transpiling 'project/packages/data-switch/index.ts'
rpt2:     watching: project/packages/data-switch/DataSwitch.ts
rpt2:               project/packages/data-switch/DataSwitchComponent.ts
rpt2: generated declarations for 'project/packages/data-switch/index.ts'
rpt2: transpiling 'project/packages/data-switch/DataSwitchComponent.ts'
rpt2:     watching: project/packages/data-switch/DataSwitch.ts
rpt2:               project/packages/core/dist/index.d.ts
rpt2: generated declarations for 'project/packages/data-switch/DataSwitchComponent.ts'
rpt2: generating target 1
rpt2: rolling caches
rpt2: writing declarations for 'project/packages/data-switch/index.ts' to 'project/packages/data-switch/dist/index.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/DataSwitchComponent.ts' to 'project/packages/data-switch/dist/DataSwitchComponent.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/DataSwitch.ts' to 'project/packages/data-switch/dist/DataSwitch.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/DataSwitchComponent.test.ts' to 'project/packages/data-switch/dist/DataSwitchComponent.test.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/PickerValidator.ts' to 'project/packages/data-switch/dist/PickerValidator.d.ts'
rpt2: generating target 2
rpt2: rolling caches
rpt2: writing declarations for 'project/packages/data-switch/index.ts' to 'project/packages/data-switch/dist/index.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/DataSwitchComponent.ts' to 'project/packages/data-switch/dist/DataSwitchComponent.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/DataSwitch.ts' to 'project/packages/data-switch/dist/DataSwitch.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/DataSwitchComponent.test.ts' to 'project/packages/data-switch/dist/DataSwitchComponent.test.d.ts'
rpt2: writing declarations for 'project/packages/data-switch/PickerValidator.ts' to 'project/packages/data-switch/dist/PickerValidator.d.ts'
created dist/index.js, dist/index.es.js in 2.2s

[2019-07-24 21:17:54] waiting for changes...
@ezolenko ezolenko added the kind: bug Something isn't working properly label Jul 25, 2019
@ezolenko
Copy link
Owner

ezolenko commented Jul 26, 2019

Should be fixed in 0.22.1

@ahramadan
Copy link
Author

Confirmed Working , Thanks

@agilgur5 agilgur5 added the topic: type-only / emit-less imports Related to importing type-only files that will not be emitted label May 8, 2022
Repository owner locked as resolved and limited conversation to collaborators May 8, 2022
@agilgur5 agilgur5 changed the title Type Declaration for Interfaces is not generated in Watch mode Declaration for interface-only files not generated in watch mode Jun 5, 2022
@agilgur5 agilgur5 changed the title Declaration for interface-only files not generated in watch mode Declaration for interface-only file not generated in watch mode Jun 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: bug Something isn't working properly topic: type-only / emit-less imports Related to importing type-only files that will not be emitted
Projects
None yet
Development

No branches or pull requests

3 participants