Cannot use namespace 'Observable' as a type
See original GitHub issueBefore opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
# Put output below this line
System:
OS: macOS 12.0.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 293.46 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.5 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.1.3 - /usr/local/bin/npm
Browsers:
Brave Browser: 95.1.31.88
Safari: 15.1
npmPackages:
@apollo/client: ^3.4.16 => 3.4.16
@apollo/client/cache: undefined ()
@apollo/client/core: undefined ()
@apollo/client/errors: undefined ()
@apollo/client/link/batch: undefined ()
@apollo/client/link/batch-http: undefined ()
@apollo/client/link/context: undefined ()
@apollo/client/link/core: undefined ()
@apollo/client/link/error: undefined ()
@apollo/client/link/http: undefined ()
@apollo/client/link/persisted-queries: undefined ()
@apollo/client/link/retry: undefined ()
@apollo/client/link/schema: undefined ()
@apollo/client/link/utils: undefined ()
@apollo/client/link/ws: undefined ()
@apollo/client/react: undefined ()
@apollo/client/react/components: undefined ()
@apollo/client/react/context: undefined ()
@apollo/client/react/data: undefined ()
@apollo/client/react/hoc: undefined ()
@apollo/client/react/hooks: undefined ()
@apollo/client/react/parser: undefined ()
@apollo/client/react/ssr: undefined ()
@apollo/client/testing: undefined ()
@apollo/client/utilities: undefined ()
@apollo/client/utilities/globals: undefined ()
@aws-amplify/ui-react: ^1.2.24 => 1.2.24
@babel/core: ^7.15.8 => 7.15.8 (7.12.9)
@emotion/react: ^11.5.0 => 11.5.0
@emotion/styled: ^11.3.0 => 11.3.0 (10.0.27)
@mui/icons-material: ^5.0.5 => 5.0.5
@mui/lab: ^5.0.0-alpha.53 => 5.0.0-alpha.53
@mui/material: ^5.0.6 => 5.0.6
@sentry/browser: ^6.14.1 => 6.14.1
@sentry/react: ^6.14.1 => 6.14.1
@sentry/tracing: ^6.14.1 => 6.14.1
@storybook/addon-actions: ^6.3.12 => 6.3.12
@storybook/addon-essentials: ^6.3.12 => 6.3.12
@storybook/addon-links: ^6.3.12 => 6.3.12
@storybook/react: ^6.3.12 => 6.3.12
@types/chrome: ^0.0.100 => 0.0.100
@types/emoji-strip: ^1.0.0 => 1.0.0
@types/faker: ^5.5.9 => 5.5.9
@types/jest: * => 27.0.2
@types/jquery: ^3.3.33 => 3.5.8
@types/lodash.debounce: ^4.0.6 => 4.0.6
@types/react: ^17.0.0 => 17.0.33
@types/react-dom: ^17.0.0 => 17.0.10
@types/valid-url: ^1.0.3 => 1.0.3
axios: ^0.21.1 => 0.21.4
babel-loader: ^8.2.2 => 8.2.3
camelcase-keys: ^6.2.2 => 6.2.2
classnames: ^2.3.1 => 2.3.1
copy-webpack-plugin: ^6.1.0 => 6.4.1
css-loader: ^5.2.5 => 5.2.7 (3.6.0)
date-fns: ^2.25.0 => 2.25.0
dotenv-webpack: ^1.8.0 => 1.8.0
email-validator: ^2.0.4 => 2.0.4
emoji-strip: ^1.0.1 => 1.0.1
faker: ^5.5.3 => 5.5.3
formik: ^2.2.6 => 2.2.9
glob: ^7.1.6 => 7.2.0
graphql: ^15.6.1 => 15.7.2 (14.5.0, 14.0.0)
graphql-request: ^3.5.0 => 3.6.1
jest: ^27.0.0 => 27.3.1
jest-css-modules-transform: ^4.2.1 => 4.3.0
jest-standard-reporter: ^2.0.0 => 2.0.0
lodash.debounce: ^4.0.8 => 4.0.8
mini-css-extract-plugin: ^1.6.0 => 1.6.2
parse-url: ^5.0.7 => 5.0.7
postcss-loader: ^4.2.0 => 4.3.0
prettier: ^2.2.1 => 2.4.1 (2.2.1)
react: ^17.0.1 => 17.0.2
react-circular-progressbar: ^2.0.4 => 2.0.4
react-dom: ^17.0.1 => 17.0.2
react-gradient-progress: ^1.0.3 => 1.0.3
react-hook-form: ^7.17.1 => 7.18.0
react-lottie-player: ^1.4.0 => 1.4.1
react-singleton-hook: ^3.2.1 => 3.2.1
rimraf: ^3.0.2 => 3.0.2 (2.7.1, 2.2.8)
sass-loader: 10.1.1 => 10.1.1
ts-jest: ^27.0.0 => 27.0.7
ts-loader: ^6.2.1 => 6.2.2
typescript: ^4.4.4 => 4.4.4
typescript-plugin-css-modules: ^3.2.0 => 3.4.0
valid-url: ^1.0.9 => 1.0.9
version-bump-prompt: ^6.1.0 => 6.1.0
wallaby-webpack: ^3.9.16 => 3.9.16
webpack: ^4.44.1 => 4.46.0
webpack-cli: ~3.3.11 => 3.3.12
webpack-merge: ~4.2.2 => 4.2.2
yup: ^0.32.9 => 0.32.11
npmGlobalPackages:
@creditkarma/graphql-validator: 0.5.0
@jetkit/cdk-runtime: 2.0.17
@jetkit/cdk: 2.0.17
aws-cdk: 1.127.0
esbuild-node-loader: 0.4.2
esbuild: 0.12.25
eslint: 7.32.0
esm: 3.2.25
esmo: 0.10.1
graphql: 15.5.3
husky: 7.0.2
import-js: 4.0.2
node-notifier: 10.0.0
npm: 8.1.3
prettier: 2.4.1
prisma-appsync: 1.0.0-beta.58.2
prisma: 2.30.3
ts-node-dev: 1.1.8
ts-node: 10.2.1
typescript-language-server: 0.6.1
typescript: 4.3.5
yarn: 1.22.17
Describe the bug
Installed amplify/auth and it won’t compile:
➜ tsc
node_modules/@aws-amplify/api/lib-esm/API.d.ts:111:34 - error TS2709: Cannot use namespace 'Observable' as a type.
111 }): Promise<GraphQLResult> | Observable<object>;
~~~~~~~~~~
Found 1 error.

I suspect the problem is conflicting versions of zen-observable-ts
myapp@0.0.35 /Users/cyber/dev/freezy
├─┬ @apollo/client@3.4.16
│ └── zen-observable-ts@1.1.0
└─┬ @aws-amplify/ui-react@1.2.24
└─┬ @aws-amplify/ui-components@1.9.4
└─┬ aws-amplify@4.3.6
├─┬ @aws-amplify/api@4.0.24
│ └─┬ @aws-amplify/api-graphql@2.2.13
│ └── zen-observable-ts@0.8.19
├─┬ @aws-amplify/core@4.3.6
│ └── zen-observable-ts@0.8.19
├─┬ @aws-amplify/datastore@3.6.0
│ └── zen-observable-ts@0.8.19
└─┬ @aws-amplify/pubsub@4.2.0
└── zen-observable-ts@0.8.19
Expected behavior
Can compile
Reproduction steps
npm i @aws-amplify/ui-react tsc
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:12
Top Results From Across the Web
angular2 meteor ionic - cannot use namespace Observable as ...
The Cannot use namespace ... as a type error seems to be a consequence of your declarations.d.ts file doing declare module '*'; ....
Read more >Fixing the "Cannot Use Namespace as a Type" Error in ...
Are you experiencing the “cannot use namespace as a type” error in TypeScript? This error can occur when you try to import types...
Read more >Node.js – Cannot use namespace as a type angular - iTecNote
Cannot use namespace 'FeatureService' as a type. I'm using angular 6 and ngrx on windows. This is my effects file, that is giving...
Read more >How to fix Cannot use namespace as a type ts(2709) in ...
It looks like you are expecting to use the default export. Perhaps for you this might work? declare type SortedArray = typeof ...
Read more >[SOLVED] Cannot Use Namespace as a Type in TypeScript
Are you experiencing the “cannot use namespace as a type” error in TypeScript? This error can occur when you try to import types...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Happened to me also. (using Angular 12+)
Same problem here, only way to get rid of this is currently
“skipLibCheck”: true
in compilerOptions of tsconfig.json