Amplify-js: Cannot find type definition file for 'paho-mqtt'.

Created on 29 Mar 2018  路  13Comments  路  Source: aws-amplify/amplify-js

typescript: node_modules/aws-amplify/lib/PubSub/Providers/MqttOverWSProvider.d.ts, line: 1
Cannot find type definition file for 'paho-mqtt'.

   L1:  import { Client } from 'paho-mqtt';
   L2:  import * as Observable from 'zen-observable';

packagejson.txt

question

Most helpful comment

@Jun711 @richardzcode Adding types of packages is the responsibility of the package developer, not the consumer, otherwise any package consumer will find himself adding many types for packages he doesn't know about, and he doesn't know when to update or delete them in case their usage was changed by the package developer. Those two definitions should be included by aws-amplify in the dependencies section.
More info: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

All 13 comments

You need to install these for type definitions
npm i 鈥搒ave-dev @types/zen-observable
npm i 鈥搒ave-dev @types/paho-mqtt

EDIT: formatting issues

for which module, i ran the command as you provided but same error

[13:29:55] typescript: node_modules/aws-amplify/lib/PubSub/Providers/MqttOverWSProvider.d.ts, line: 1
Cannot find type definition file for 'paho-mqtt'.

   L1:  import { Client } from 'paho-mqtt';
   L2:  import * as Observable from 'zen-observable';

[13:29:55] typescript: node_modules/aws-amplify/lib/PubSub/Providers/MqttOverWSProvider.d.ts, line: 2
Cannot find type definition file for 'zen-observable'.

   L1:  import { Client } from 'paho-mqtt';
   L2:  import * as Observable from 'zen-observable';
   L3:  import { AbstractPubSubProvider } from './PubSubProvider';

[13:29:55] typescript: node_modules/aws-amplify/lib/PubSub/Providers/PubSubProvider.d.ts, line: 1
Cannot find type definition file for 'zen-observable'.

   L1:  import * as Observable from 'zen-observable';
   L2:  import { PubSubProvider, ProvidertOptions } from '../types';

[13:29:55] typescript: node_modules/aws-amplify/lib/PubSub/PubSub.d.ts, line: 1
Cannot find type definition file for 'zen-observable'.

   L1:  import * as Observable from 'zen-observable';
   L2:  import { PubSubProvider, PubSubOptions, ProvidertOptions } from './types';

[13:29:55] typescript: node_modules/aws-amplify/lib/PubSub/types/Provider.d.ts, line: 1
Cannot find type definition file for 'zen-observable'.

   L1:  import * as Observable from 'zen-observable';
   L2:  import { ProvidertOptions } from './PubSub';

You need to install these for type definitions
npm i 鈥搒ave-dev @types/zen-observable
npm i 鈥搒ave-dev @types/paho-mqtt

my previous comment had formatting issue.

@ashishsoni I believe with @Jun711 updated commands the issue should be fixed. Please reopen this issue if problem remains.

@Jun711 @richardzcode Adding types of packages is the responsibility of the package developer, not the consumer, otherwise any package consumer will find himself adding many types for packages he doesn't know about, and he doesn't know when to update or delete them in case their usage was changed by the package developer. Those two definitions should be included by aws-amplify in the dependencies section.
More info: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

I'm seeing this behavior again on the latest version of aws-amplify - can this issue be investigated once more?

@richardzcode @powerful23 I just wanted to bump this in case it being closed reduces visibility. I think this should be re-opened. The recent changes to the library have taken out the type definitions by apparently removing the third-party dependency and dropping the file in the src/vendor folder. Please let me know if I can help provide any additional information.

@mwarger thanks for the feedback, investigating.

@powerful23 can this be re-opened?

@mwarger - I'm continuing this discussion on #1836 .

@mwarger this issue should have been fixed by #1821

I'm still getting this issue - any ideas people?

@kylekirkby are you using the latest version?

Was this page helpful?
0 / 5 - 0 ratings