Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
375 stars 178 forks source link

packages/verify/lib/interfaces/VerifyControlError.ts contains a broken import path #800

Closed duckdotapk closed 1 year ago

duckdotapk commented 1 year ago

Expected Behavior

This file should import the CheckStatus enum as follows:

import { CheckStatus } from "../enums/index";

Current Behavior

Instead, it currently imports it by going up too many directories, out of the lib folder and then back into it:

import { CheckStatus } from '../../lib/enums/index';

This confuses the TypeScript compiler and causes an error when attempting to use the package because the lib folder is not included in the package on NPM:

[11:15:26 AM] Starting compilation in watch mode...

node_modules/@vonage/verify/dist/interfaces/VerifyControlError.d.ts:1:29 - error TS2307: Cannot find module '../../lib/enums/index' or its corresponding type declarations.

1 import { CheckStatus } from '../../lib/enums/index';
                              ~~~~~~~~~~~~~~~~~~~~~~~

[11:15:33 AM] Found 1 error. Watching for file changes.

Possible Solution

See "Expected behaviour" above.

It is correct for this package to not include the lib folder, of course, and I believe correcting the path should cause the TSC to not try to looking there like it does right now.

Steps to Reproduce (for bugs)

Attempt to compile TypeScript code that imports from a Vonage package which imports this script.

I am not sure which script in my project is causing this to get included as I do not have a direct dependency on @vonage/verify, instead another Vonage module is depending on it.

Context

It just simply causes an error in the TypeScript compilation step which is not ideal.

Your Environment

manchuck commented 1 year ago

@duckdotapk Can you also pass along which version of @vonage/verify you are using (npm ls @vonage/verify)? There were some import issues with one of the versions published recently. I thought I got them all but some might have slipped though

duckdotapk commented 1 year ago

@manchuck Sure, here is that information:

`-- @vonage/server-sdk@3.1.1
  `-- @vonage/verify@1.1.1

Edit: Note that I updated some Vonage packages since my initial message so this server-sdk version is slightly different than before. The issue is still there though.

manchuck commented 1 year ago

@duckdotapk, thanks for that. I found the issue and opened PR #803

Sorry for the lousy refractor.

duckdotapk commented 1 year ago

No worries, it happens! I appreciate the incoming fix.

manchuck commented 1 year ago

Fixed in 1.1.2 https://www.npmjs.com/package/@vonage/verify/v/1.1.2