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

Not all code paths return a value #141

Open
jbistis opened this issue Dec 26, 2021 · 2 comments
Open

Not all code paths return a value #141

jbistis opened this issue Dec 26, 2021 · 2 comments

Comments

@jbistis
Copy link

jbistis commented Dec 26, 2021

angular/cli 13.1.2 / typescript 4.5.4 / ngx-webcam 0.4.1
Getting 2 errors:
webcam.component.ts:151:6 - error TS7030: Not all code paths return a value.
private static getDeviceIdFromMediaStreamTrack( mediaStreamTrack: MediaStreamTrack ): string { if ( mediaStreamTrack.getSettings && mediaStreamTrack.getSettings() && mediaStreamTrack.getSettings().deviceId ) { return mediaStreamTrack.getSettings().deviceId; } else if ( mediaStreamTrack.getConstraints && mediaStreamTrack.getConstraints() && mediaStreamTrack.getConstraints().deviceId ) { const deviceIdObj: ConstrainDOMString = mediaStreamTrack.getConstraints().deviceId; return WebcamComponent.getValueFromConstrainDOMString(deviceIdObj); } }

webcam.component.ts:178:6 - error TS7030: Not all code paths return a value.
private static getFacingModeFromMediaStreamTrack(
mediaStreamTrack: MediaStreamTrack
): string {
if (mediaStreamTrack) {
if (
mediaStreamTrack.getSettings &&
mediaStreamTrack.getSettings() &&
mediaStreamTrack.getSettings().facingMode
) {
return mediaStreamTrack.getSettings().facingMode;
} else if (
mediaStreamTrack.getConstraints &&
mediaStreamTrack.getConstraints() &&
mediaStreamTrack.getConstraints().facingMode
) {
const facingModeConstraint: ConstrainDOMString =
mediaStreamTrack.getConstraints().facingMode;
return WebcamComponent.getValueFromConstrainDOMString(
facingModeConstraint
);
}
}
}

@basst314
Copy link
Owner

Hi @jbistis,
this sounds like an issue caused by your linter. Can you share what linter you're using (e.g. ESLint) and if you have applied any specific rules (e.g. 'consistent-return')?
Thanks

@jbistis
Copy link
Author

jbistis commented Dec 30, 2021

Yes, thanks. The update was to set "noImplicitReturns": false per https://stackoverflow.com/questions/51446242/how-to-fix-the-issue-not-all-the-code-paths-return-value

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

2 participants