Fluentui: TS2694: Namespace 'React' has no exported member 'ButtonHTMLAttributes'

Created on 20 Dec 2017  路  7Comments  路  Source: microsoft/fluentui

Hi All,
It seems that the office-ui-fabric-react is broken with my project file. When I try to import a button from office-ui-fabric-react facing below error .

ERROR in [at-loader] ./node_modules/office-ui-fabric-react/lib/components/Button/Button.types.d.ts:21:45
TS2694: Namespace 'React' has no exported member 'AllHTMLAttributes'.
ERROR in [at-loader] ./node_modules/office-ui-fabric-react/lib/components/Button/Button.types.d.ts:156:23
TS2694: Namespace 'React' has no exported member 'ButtonHTMLAttributes'.
ERROR in [at-loader] ./node_modules/office-ui-fabric-react/lib/components/Button/Button.types.d.ts:156:71
TS2694: Namespace 'React' has no exported member 'AnchorHTMLAttributes'.
ERROR in [at-loader] ./node_modules/office-ui-fabric-react/lib/components/Image/Image.types.d.ts:4:44
TS2694: Namespace 'React' has no exported member 'ImgHTMLAttributes'.

Below is my package.json

{
"name": "Projectname ",
"private": true,
"version": "0.0.0",
"devDependencies": {
"": "4.6.0",
"": "16.0.31",
"": "16.0.3",
"": "3.0.5",
"": "4.0.19",
"": "4.2.3",
"": "1.13.3",
"": "15.5.2",
"": "^1.7.13",
"aspnet-webpack": "2.0.1",
"aspnet-webpack-react": "3.0.0",
"awesome-typescript-loader": "3.4.1",
"bootstrap": "3.3.7",
"css-loader": "0.28.4",
"event-source-polyfill": "0.0.9",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "0.11.2",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"react": "16.2.0",
"react-dom": "16.2.0",
"react-hot-loader": "3.1.3",
"react-router-dom": "4.2.2",
"style-loader": "0.19.1",
"typescript": "2.6.2",
"url-loader": "0.5.9",
"webpack": "3.10.0",
"webpack-hot-middleware": "2.21.0",
"react-router": "4.2.0",
"immutability-helper": "2.6.2",
"tslib": "1.8.1",
"office-ui-fabric-react": "5.34.2"
}
}

Any help appreciated!!

Discussion 馃檵

Most helpful comment

Ignore my "Same problem here, with latest (as of 11 Apr) React typings, 16.3.8" complaint - I was actually looking at the wrong version. React 16.3.8 and Fabric 5.80 work fine together.

All 7 comments

Hello, I have the same problem with latest version (5.39.0), do you find any solution? With version 4.28.0 everything works

It seems that you may be missing @types/react package or may be on an older version. Can you try installing that (or updating to a newer version)?

The error is complaining that the type React.AllHTMLAttributes is not defined, which leads me to think you're missing the current React types.

I do recognize the missing types are confusing. I believe we should just include the @types/react in the office-ui-fabric-react package dependencies list, even if some people don't need it or may have a different version, to avoid this confusion.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Fabric React!

Ignore my "Same problem here, with latest (as of 11 Apr) React typings, 16.3.8" complaint - I was actually looking at the wrong version. React 16.3.8 and Fabric 5.80 work fine together.

If you search ButtonHTMLAttributes in the @types/[email protected] version:

https://unpkg.com/@types/react@16.3.8/index.d.ts

I see it defined. @SGSmyth can you check your version?

I wonder if we should just make @types/react peer deps, or even just deps.

Confirmed this works. Closing bug.

Was this page helpful?
0 / 5 - 0 ratings