Typescript: Unable to overload function signatures via global

Created on 1 May 2018  路  2Comments  路  Source: microsoft/TypeScript



TypeScript Version: Version 2.9.0-dev.20180426


overload, global:

Code

// foo.ts
import 'jasmine';

declare global {
  function expect(element: HTMLElement): void;
}
// index.d.ts
declare function expect(spy: Function): void;
// tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "baseUrl": ".",
    "paths": {
      "jasmine": [
        "./index"
      ]
    },
    "strict": true
  }
}

Expected behavior:
No errors.

Actual behavior:
"Overload signatures must all be exported or non-exported."

Playground Link:
N/A

Related Issues:
https://github.com/Microsoft/TypeScript/issues/16430

Bug Fixed

Most helpful comment

Thanks for the quick fix!

All 2 comments

Add @rkirov

Thanks for the quick fix!

Was this page helpful?
0 / 5 - 0 ratings