office-js-helpers icon indicating copy to clipboard operation
office-js-helpers copied to clipboard

TypeScript 2.8.1 errors with latest office-js-helpers and office-js types

Open ydogandjiev opened this issue 6 years ago • 21 comments

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?

ydogandjiev avatar Apr 12 '18 19:04 ydogandjiev

FYI @WrathOfZombies, @sachingupta

ydogandjiev avatar Apr 12 '18 19:04 ydogandjiev

Yes I noticed this as well. Will address this. FYI @Zlatkovsky

WrathOfZombies avatar Apr 17 '18 08:04 WrathOfZombies

Or perhaps @casieber can take a look?

Zlatkovsky avatar Apr 17 '18 16:04 Zlatkovsky

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.

casieber avatar Apr 17 '18 17:04 casieber

@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.

WrathOfZombies avatar Apr 18 '18 15:04 WrathOfZombies

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 avatar May 06 '18 21:05 WrathOfZombies

@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?

default-param default function in code

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

LanceEa avatar Jun 27 '18 13:06 LanceEa

The issue has cropped up again. I have @types/office-js as follows;

"@types/office-js": "^0.0.78",

Thanks.

syncimprov avatar Jun 30 '18 02:06 syncimprov

I have the same issue I use "@types/office-js": "0.0.83",

Thanks

KrzysiekKuczma avatar Jul 10 '18 07:07 KrzysiekKuczma

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!

TheSamsterZA avatar Jul 26 '18 06:07 TheSamsterZA

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?

ginomessmer avatar Sep 24 '18 14:09 ginomessmer

Reopening, re-assigning to @sumurthy who was looking into getting the NPM package updated.

Zlatkovsky avatar Sep 24 '18 17:09 Zlatkovsky

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.

Aseelaldallal avatar Oct 07 '18 16:10 Aseelaldallal

Hi Guys, has this been resolved?

piyushgodara avatar Nov 02 '18 01:11 piyushgodara

I'm getting the same error in Excel Add-in, Any help would be great!

JimbobTheSailor avatar Nov 16 '18 03:11 JimbobTheSailor

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.

tomp736 avatar Jan 23 '19 16:01 tomp736

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.

tomp736 avatar Jan 23 '19 17:01 tomp736

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"
  ]
}

kespinosa05 avatar Feb 01 '19 16:02 kespinosa05

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

kespinosa05 avatar Feb 01 '19 17:02 kespinosa05

+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

mrbfrank avatar Jan 16 '20 18:01 mrbfrank

+1 When will this be addressed?

tomp736 avatar Jan 22 '20 20:01 tomp736