OfficeDev / office-js-helpers

[ARCHIVED] A collection of helpers to simplify development of Office Add-ins & Microsoft Teams Tabs
MIT License
126 stars 57 forks source link

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

Open ydogandjiev opened 6 years ago

ydogandjiev commented 6 years ago

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 commented 6 years ago

FYI @WrathOfZombies, @sachingupta

WrathOfZombies commented 6 years ago

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

Zlatkovsky commented 6 years ago

Or perhaps @casieber can take a look?

casieber commented 6 years ago

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.

WrathOfZombies commented 6 years ago

@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 commented 6 years ago

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.

LanceEa commented 6 years ago

@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

syncimprov commented 6 years ago

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

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

Thanks.

KrzysiekKuczma commented 6 years ago

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

Thanks

TheSamsterZA commented 6 years ago

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!

ginomessmer commented 6 years ago

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?

Zlatkovsky commented 6 years ago

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

Aseelaldallal commented 6 years ago

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.

piyushgodara commented 5 years ago

Hi Guys, has this been resolved?

JimbobTheSailor commented 5 years ago

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

tomp736 commented 5 years ago

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 commented 5 years ago

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.

kespinosa05 commented 5 years ago

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 commented 5 years ago

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

mrbfrank commented 4 years ago

+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

tomp736 commented 4 years ago

+1 When will this be addressed?