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

what must be the issue here? #20

Open
jawwadHussain302 opened this issue Sep 29, 2022 · 3 comments
Open

what must be the issue here? #20

jawwadHussain302 opened this issue Sep 29, 2022 · 3 comments

Comments

@jawwadHussain302
Copy link

FAIL src/tests/LinearSearchList.ts
● Test suite failed to run

src/day2/LinearSearchList.ts:1:76 - error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. 
@echosonusharma
Copy link

@jawwadHussain302 you have declared a return type and are not returning anything. pls check if you are returning properly for that LinearSearchList function.

@MWest2020
Copy link

@jawwadHussain302, I had the same. The test ran on day2 instead of day1 for me, if you try your code in the LinearSearchList.ts in the /day2 folder, you'll get the green checks.

export default function linear_search(haystack: number[], needle: number): boolean {
   for (let i = 0 ; i < haystack.length; i++){
       if (haystack[i] === needle){
            return true;
       }
   }
   return false;
} 

@GGuinea
Copy link

GGuinea commented Apr 3, 2023

Thank you @MWest2020

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

4 participants