TypeScript Version: 3.3.0-dev.20181229
Search Terms:
default export function property namespace
Code
export default function someFunc() {
return 'hello!';
}
someFunc.someProp = 'yo';
Expected behavior:
The declaration file should be valid
Actual behavior:
packages/proj-1/build/index.d.ts:2:26 - error TS1005: ';' expected.
2 export default namespace someFunc {
~~~~~~~~
packages/proj-1/build/index.d.ts:2:35 - error TS1005: ';' expected.
2 export default namespace someFunc {
Playground Link: Cannot be reproduced in the playground as the issue is in the d.ts file, not the JS. However, I've setup a repository: https://github.com/SimenB/tsc-b-auch
Related Issues: None found
Note that the file is generated successfully, it's only when trying to consume it things fall apart
Haven't tried this, but you can probably get around this by writing
function someFunc() {
return 'hello!';
}
someFunc.someProp = 'yo';
export default someFunc;
Yeah, that works! Thanks 馃檪
Thanks @Kingwl!
Have the same issue.
@DanielRosenwasser Is this by design?
yarn tsc --version
Version 3.4.5
This is scheduled for 3.5.0. You can npm install typescript@next and if you're still seeing issues, open up a new issue.
Most helpful comment
Haven't tried this, but you can probably get around this by writing