office-js-helpers
office-js-helpers copied to clipboard
TypeScript 2.8.1 errors with latest office-js-helpers and office-js types
Relevant modules from from package.json:
"@microsoft/office-js-helpers": "^1.0.2",
"@types/office-js": "0.0.54",
"typescript": "^2.8.1",
Result in the following errors:
ERROR in /Users/ydogandjiev/Projects/microsoft-teams-sample-todo/node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts
(287,41): error TS2503: Cannot find namespace 'Excel'.
ERROR in /Users/ydogandjiev/Projects/microsoft-teams-sample-todo/node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts
(287,106): error TS2503: Cannot find namespace 'Excel'.
ERROR in /Users/ydogandjiev/Projects/microsoft-teams-sample-todo/node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts
(628,10): error TS1319: A default export can only be used in an ECMAScript-style module.
Known issue?
FYI @WrathOfZombies, @sachingupta
Yes I noticed this as well. Will address this. FYI @Zlatkovsky
Or perhaps @casieber can take a look?
I'm not getting the Cannot find namespace 'Excel'
error, but I do see the default export
issue.
For the default export
error, this is because the output typings are still using the rather antiquated namespace
/ internal module pattern and trying to export a default from the namespace.
Moving away from TS namespaces and into just standard modules is something we need to do not only for this package but for standard office js as well.
I'll take a look at the changes required for that here.
@Zlatkovsky , @casieber - Reopening this issue as we need to address the other bit. If you clone the following sample and this branch (https://github.com/OfficeDev/microsoft-teams-sample-todo/tree/saching/UsingMicrosoftTeamClientSDK_npmPackage) you'll observe the issue.
This is now fixed. To address the issue, please also install @types/office-js
. I'll be listing office-js as a peer dependency in the next update.
@WrathOfZombies @Zlatkovsky -
I see the change has been committed to master but I'm still seeing this issue. I have 1.02 installed from NPM. Does a new release just need to be cut for NPM?


In my package.json I have:
"@types/office-js": "~0.0.77",
"@microsoft/office-js-helpers": "~1.0.2",
"typescript": "2.7.2",
Thanks, Lance
The issue has cropped up again. I have @types/office-js as follows;
"@types/office-js": "^0.0.78",
Thanks.
I have the same issue
I use "@types/office-js": "0.0.83",
Thanks
Hello @Zlatkovsky / @casieber.
As mentioned by @LanceEa here, the current release (1.0.2) causes the following error:
ERROR in node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts(628,10):
error TS1319: A default export can only be used in an ECMAScript-style module.
(NOTE: It does not seem to matter if I have @types/office-js installed).
Please update office.helpers.d.ts.
Change
export default function stringify(value: any): string;
to
export function stringify(value: any): string;
and then publish @microsoft/office-js-helpers 1.0.3 with this fix.
Thank you!
Hey @WrathOfZombies, this issue is still on going and it looks like the NPM package is still running on 1.0.2 for the last 6 months. Any chance to get a new version up and running which resolves this and other issues?
Reopening, re-assigning to @sumurthy who was looking into getting the NPM package updated.
Hi Guys, has this been resolved?
I'm still getting ERROR in node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts(287,41): error TS2503: Cannot find namespace 'Excel'. node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts(287,106): error TS2503: Cannot find namespace 'Excel'. node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts(628,10): error TS1319: A default export can only be used in an ECMAScript-style module.
Hi Guys, has this been resolved?
I'm getting the same error in Excel Add-in, Any help would be great!
Seeing the same issue.
"typescript": "^2.9.2",
"@types/office-js": "0.0.148",
"@microsoft/office-js-helpers": "^1.0.2",
ERROR in [at-loader] ./node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts:628:10 TS1319: A default export can only be used in an ECMAScript-style module.
Seeing the same issue.
"typescript": "^2.9.2", "@types/office-js": "0.0.148", "@microsoft/office-js-helpers": "^1.0.2",
ERROR in [at-loader] ./node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts:628:10 TS1319: A default export can only be used in an ECMAScript-style module.
I switched from awesome-typescript-loader to ts-loader. Error is gone.
Hi, this work for me add @types/office-js in tsconfig.app.json file compilerOptions type sample:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": [ "@types/office-js"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
For error
ERROR in node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts(628,10): error TS1319: A default export can only be used in an ECMAScript-style module.>
downgrade version to "@microsoft/office-js-helpers": "1.0.1" work for me
+1 I see the same error with TypeScript compiler:
node_modules/@microsoft/office-js-helpers/dist/office.helpers.d.ts:628:10 - error TS1319: A default export can only be used in an ECMAScript-style module.
TypeScript v3.7.4
@types/office-js v1.0.62
@microsoft/office-js-helpers v1.0.2
Would be great to see this fixed, but this postinstall script worked for me: https://github.com/OfficeDev/office-js-helpers/pull/84#issuecomment-448973219
+1 When will this be addressed?