Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript Compile errors #91

Open
tfsjohan opened this issue Jul 22, 2023 · 10 comments
Open

TypeScript Compile errors #91

tfsjohan opened this issue Jul 22, 2023 · 10 comments

Comments

@tfsjohan
Copy link

This package causes several TSC errors.

node_modules/@robinbobin/react-native-google-drive-api-wrapper/ListQueryBuilder.ts(1,29): error TS7016: Could not find a declaration file for module 'simple-common-utils'. '/home/runner/work/cloudqr-app/cloudqr-app/node_modules/simple-common-utils/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/simple-common-utils if it exists or add a new declaration (.d.ts) file containing declare module 'simple-common-utils';
node_modules/@robinbobin/react-native-google-drive-api-wrapper/api/aux/Uris.ts(1,34): error TS7016: Could not find a declaration file for module 'simple-common-utils'. '/home/runner/work/cloudqr-app/cloudqr-app/node_modules/simple-common-utils/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/simple-common-utils if it exists or add a new declaration (.d.ts) file containing declare module 'simple-common-utils';
node_modules/@robinbobin/react-native-google-drive-api-wrapper/api/aux/uploaders/MultipartUploader.ts(4,8): error TS7016: Could not find a declaration file for module 'simple-common-utils'. '/home/runner/work/cloudqr-app/cloudqr-app/node_modules/simple-common-utils/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/simple-common-utils if it exists or add a new declaration (.d.ts) file containing declare module 'simple-common-utils';
node_modules/@robinbobin/react-native-google-drive-api-wrapper/api/aux/uploaders/MultipartUploader.ts(5,18): error TS7016: Could not find a declaration file for module 'utf8'. '/home/runner/work/cloudqr-app/cloudqr-app/node_modules/utf8/utf8.js' implicitly has an 'any' type.
Try npm i --save-dev @types/utf8 if it exists or add a new declaration (.d.ts) file containing declare module 'utf8';
node_modules/@robinbobin/react-native-google-drive-api-wrapper/api/aux/utils.ts(5,8): error TS7016: Could not find a declaration file for module 'simple-common-utils'. '/home/runner/work/cloudqr-app/cloudqr-app/node_modules/simple-common-utils/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/simple-common-utils if it exists or add a new declaration (.d.ts) file containing declare module 'simple-common-utils';
node_modules/@robinbobin/react-native-google-drive-api-wrapper/api/permissions/Permissions.ts(11,40): error TS2322: Type 'object | undefined' is not assignable to type 'object'.
Type 'undefined' is not assignable to type 'object'.
node_modules/@robinbobin/react-native-google-drive-api-wrapper/api/permissions/Permissions.ts(17,54): error TS2322: Type 'object | undefined' is not assignable to type 'object'.
Type 'undefined' is not assignable to type 'object'.

@RobinBobin
Copy link
Owner

RobinBobin commented Jul 24, 2023 via email

@adamblvck
Copy link

adamblvck commented Oct 16, 2023

I'm not sure if this belongs to this issue, but perhaps it's worth mentioning as it's related to TS errors.

While trying to make run one of my react-native apps in web using expo, react-native-web, and webpack, I'm getting the following errors:

ERROR in ./node_modules/@robinbobin/react-native-google-drive-api-wrapper/GDrive.ts 7:10
Module parse failed: Unexpected token (7:10)
File was processed with these loaders:
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| 
| export default class GDrive {
>   private readonly __apis = new Map <string, GDriveApi> ();
|   
|   constructor() {

ERROR in ./node_modules/@robinbobin/react-native-google-drive-api-wrapper/HttpError.ts 2:10
Module parse failed: Unexpected token (2:10)
File was processed with these loaders:
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| export default class HttpError extends Error {
>   private __json?: any;
|   private __response: Response;
|   private __text?: string;

ERROR in ./node_modules/@robinbobin/react-native-google-drive-api-wrapper/ListQueryBuilder.ts 3:5
Module parse failed: Unexpected token (3:5)
File was processed with these loaders:
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| import { StaticUtils } from "simple-common-utils";
| 
> type Key = string;
| type Value = boolean | number | string;
| type KeyOrValue = Key | Value;

ERROR in ./node_modules/@robinbobin/react-native-google-drive-api-wrapper/MimeTypes.ts 1:0
Module parse failed: The keyword 'enum' is reserved (1:0)
File was processed with these loaders:
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
> enum MimeTypes {
|   BINARY     = 'application/octet-stream',
|   CSV        = 'text/csv',

ERROR in ./node_modules/@robinbobin/react-native-google-drive-api-wrapper/UnexpectedFileCountError.ts 1:5
Module parse failed: Unexpected token (1:5)
File was processed with these loaders:
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
> type ExpectedCount = number[] | number;
| 
| export default class UnexpectedFileCountError extends Error {

Now it may seem that this is related to how I'm loading the files. However when using ts-loader instead, I'm getting a bunch more TS errors on this very library, very similar to OP.

My first idea is that the ts-files aren't transpiled to js, and thus webpack isn't scooping up the library correctly with source-map-loader.

Either way, currently being prohibited from using this wonderful wrapper outside an iOS and Android context, which works otherwise very well, and which I'm very grateful for it.

@RobinBobin
Copy link
Owner

Hi @adamblvck ,
Sorry, but I designed this lib for android / ios only. I hardly imagine it will work with expo, moreover with webpack.
It happened to become a rather abandoned project, with another version stuck halfway, as I can't find enough time for it 😞 .

@adamblvck
Copy link

@RobinBobin Expo (using EAS workflow) actually works quite well with your lib!
Sad to hear this, but I'll see how I'll manage this going forward.

@RobinBobin
Copy link
Owner

Good luck 👍 !

@namnh-0652
Copy link

@adamblvck did you bypass it? how to ignore these code from type-check?

@namnh-0652
Copy link

@RobinBobin https://github.com/RobinBobin/react-native-google-drive-api-wrapper/pull/96/files
Did this PR fix the type-check, Please release new version when you have time, thank you.

@namnh-0652
Copy link

Still error type-check from 1.2.4

@Serchinastico
Copy link

I found myself having this error with an Expo project and to solve it I just created a new react-native-google-drive-api-wrapper.d.ts file in my project with the following contents:

declare module "simple-common-utils";
declare module "utf8";

PD: Thanks for the library @RobinBobin, it has been a lifesaver 🙌

@RobinBobin
Copy link
Owner

Guys, I retrofitted the library, typing everything properly.
Should be no TS errrors.
2.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants