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

avoid typescript error #262

Merged
merged 3 commits into from
Jun 27, 2020
Merged

avoid typescript error #262

merged 3 commits into from
Jun 27, 2020

Conversation

lselden
Copy link
Contributor

@lselden lselden commented Jun 25, 2020

keeps the following errors from happening when compiling (with strict: true in tsconfig.json):

node_modules/emailjs/smtp/mime.ts:109:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

109             lines.push(curLine);
                           ~~~~~~~

node_modules/emailjs/smtp/mime.ts:206:3 - error TS2322: Type 'string[]' is not assignable to type 'never[]'.
  Type 'string' is not assignable to type 'never'.

206     parts =
        ~~~~~

node_modules/emailjs/smtp/mime.ts:220:16 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

                                   ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/emailjs/smtp/mime.ts:227:34 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

227     str.substring(j) && parts.push(str.substring(j));
                                       ~~~~~~~~~~~~~~~~

node_modules/emailjs/smtp/mime.ts:228:3 - error TS2322: Type 'string[]' is not assignable to type 'never[]'.
  Type 'string' is not assignable to type 'never'.

228     parts = parts.map((x) => encoder.encode(x)).map((x) => encodeBase64(x));
        ~~~~~

keeps the following errors from happening when compiling:
```
node_modules/emailjs/smtp/mime.ts:109:15 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

109             lines.push(curLine);
                           ~~~~~~~

node_modules/emailjs/smtp/mime.ts:206:3 - error TS2322: Type 'string[]' is not assignable to type 'never[]'.
  Type 'string' is not assignable to type 'never'.

206     parts =
        ~~~~~

node_modules/emailjs/smtp/mime.ts:220:16 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

                                   ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/emailjs/smtp/mime.ts:227:34 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.

227     str.substring(j) && parts.push(str.substring(j));
                                       ~~~~~~~~~~~~~~~~

node_modules/emailjs/smtp/mime.ts:228:3 - error TS2322: Type 'string[]' is not assignable to type 'never[]'.
  Type 'string' is not assignable to type 'never'.

228     parts = parts.map((x) => encoder.encode(x)).map((x) => encodeBase64(x));
        ~~~~~
```
@zackschuster
Copy link
Collaborator

which version of typescript do you use? we compile in strict mode & don't see this error.

@lselden
Copy link
Contributor Author

lselden commented Jun 25, 2020

ahh - it's setting "noImplicitAny": false in tsconfig.json that triggers the error, not "strict". I'm using Typescript version 3.9.5

Copy link
Collaborator

@zackschuster zackschuster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you strongly type this instead? e.g. lines: string[]. the parts variable on L192 should receive the same treatment :)

@zackschuster
Copy link
Collaborator

how odd — that's exactly the opposite of what i'd expect! i requested a style change, but otherwise LGTM :)

@zackschuster zackschuster merged commit a9c3791 into eleith:master Jun 27, 2020
@zackschuster
Copy link
Collaborator

@eleith can we do a patch release for this please?

@eleith
Copy link
Owner

eleith commented Jun 27, 2020

done.

@zackschuster
Copy link
Collaborator

ty :)

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

Successfully merging this pull request may close these issues.

3 participants