From 0dcc666a9113c66a1622d37404be90f322bbb4a2 Mon Sep 17 00:00:00 2001 From: Paul-Louis Hery Date: Fri, 20 Aug 2021 19:29:56 +0200 Subject: [PATCH] chore: set allowSyntheticDefaultImport to false to improve compatibility --- package-lock.json | 1 - src/client-mixins/oauth1.helper.ts | 2 +- src/stream/TweetStreamEventCombiner.ts | 2 +- src/test/utils.ts | 2 +- src/types/v1/tweet.v1.types.ts | 2 +- src/v1/client.v1.write.ts | 2 +- src/v1/media-helpers.v1.ts | 2 +- test/media-upload.test.ts | 4 ++-- tsconfig.json | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ee09ae..ef3284a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "twitter-api-v2", "version": "1.3.0", "license": "Apache-2.0", "devDependencies": { diff --git a/src/client-mixins/oauth1.helper.ts b/src/client-mixins/oauth1.helper.ts index cb08081..0ca9c2a 100644 --- a/src/client-mixins/oauth1.helper.ts +++ b/src/client-mixins/oauth1.helper.ts @@ -1,4 +1,4 @@ -import crypto from 'crypto'; +import * as crypto from 'crypto'; // ---------------------------------------------------------- // LICENSE: This code partially belongs to oauth-1.0a package diff --git a/src/stream/TweetStreamEventCombiner.ts b/src/stream/TweetStreamEventCombiner.ts index e625189..0a0dcd0 100644 --- a/src/stream/TweetStreamEventCombiner.ts +++ b/src/stream/TweetStreamEventCombiner.ts @@ -1,4 +1,4 @@ -import EventEmitter from 'events'; +import { EventEmitter } from 'events'; import { ETwitterStreamEvent } from '../types'; import type TweetStream from './TweetStream'; diff --git a/src/test/utils.ts b/src/test/utils.ts index 23ed7e1..4194387 100644 --- a/src/test/utils.ts +++ b/src/test/utils.ts @@ -1,5 +1,5 @@ import { TwitterApi } from '..'; -import dotenv from 'dotenv'; +import * as dotenv from 'dotenv'; dotenv.config({ path: __dirname + '/../../.env' }); diff --git a/src/types/v1/tweet.v1.types.ts b/src/types/v1/tweet.v1.types.ts index 64b8301..895828f 100644 --- a/src/types/v1/tweet.v1.types.ts +++ b/src/types/v1/tweet.v1.types.ts @@ -1,5 +1,5 @@ import type { BooleanString, NumberString } from '../shared.types'; -import type fs from 'fs'; +import type * as fs from 'fs'; import { UserV1 } from './user.v1.types'; import { CoordinateV1, PlaceV1, TweetEntitiesV1, TweetExtendedEntitiesV1 } from './entities.v1.types'; diff --git a/src/v1/client.v1.write.ts b/src/v1/client.v1.write.ts index fff9137..9432239 100644 --- a/src/v1/client.v1.write.ts +++ b/src/v1/client.v1.write.ts @@ -10,7 +10,7 @@ import { TweetV1, UploadMediaV1Params, } from '../types'; -import fs from 'fs'; +import * as fs from 'fs'; import { getFileHandle, getFileSizeFromFileHandle, getMediaCategoryByMime, getMimeType, readNextPartOf, sleepSecs, TFileHandle } from './media-helpers.v1'; const UPLOAD_ENDPOINT = 'media/upload.json'; diff --git a/src/v1/media-helpers.v1.ts b/src/v1/media-helpers.v1.ts index d21605a..3afd8d9 100644 --- a/src/v1/media-helpers.v1.ts +++ b/src/v1/media-helpers.v1.ts @@ -1,4 +1,4 @@ -import fs from 'fs'; +import * as fs from 'fs'; import type { TUploadableMedia, TUploadTypeV1 } from '../types'; // ------------- diff --git a/test/media-upload.test.ts b/test/media-upload.test.ts index 025b6e3..8241faf 100644 --- a/test/media-upload.test.ts +++ b/test/media-upload.test.ts @@ -2,8 +2,8 @@ import 'mocha'; import { expect } from 'chai'; import { TwitterApi } from '../src'; import { getUserClient } from '../src/test/utils'; -import fs from 'fs'; -import path from 'path'; +import * as fs from 'fs'; +import * as path from 'path'; let client: TwitterApi; const dirname = __dirname; diff --git a/tsconfig.json b/tsconfig.json index 37b8595..d42df5c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -47,7 +47,7 @@ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "allowSyntheticDefaultImports": false, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */