Skip to content

Allow declarations:true to work with checkJsΒ #15718

@nojvek

Description

@nojvek

First of all, I bow down to the typescript gods for blessing us with checkJs. It has kept our children fed. However puny humans still pray for more. :godmode: πŸ™ πŸ™‡ πŸ™‡β€β™€οΈ

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)
2.3

Code

/**
 * @param {string} str
 * @returns {string}
 */
export function snakecase(str) {
  return str.replace(/\_/g, `-`);
}
// A *self-contained* demonstration of the problem follows...
{
  "compilerOptions":{
    "checkJs": true,
    "declaration": true,
    "noEmit": true
  }
}

Expected behavior:
Running tsc on a project that uses js types should allow emitting a .d.ts like you would in a typescript project. This would allow projects to automatically emit typings for their project without having to maintain a separate .d.ts file that they need to keep in sync.

typings are documentation and if they are separate from code, they will eventually fall out of sync. Making this super easy to do with auto-generation will help a ton of javascript projects keep their typings up-to-date.

Actual behavior:
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions