title: Implement Joi in Typescript
body: <p>Simple joi validation snippet in javascript.It will simply return an error object when validation fails.</p>
  <p><strong>validate.js</strong></p>
  <pre><code>const Joi =require(&quot;joi&quot;);
  
  function validateObject (input) {
  const schema = {
      key: Joi.string().required(),
    };
    return Joi.validate(input, schema);
  };
  
  let {error} = validateObject({key:5})
  console.log(error)
  </code></pre>
  <p>Now I am learning typescript and like to do the exact functionality in TS.I am aware that Joi is  a javascript library but can we make use of it in Typescript.When exploring I came across some alternatives like <a href="https://github.com/joiful-ts/joiful/issues" rel="noreferrer">https://github.com/joiful-ts/joiful</a>.</p>
  <p>I am curious to know if there is any straightforward approach using <strong>Joi directly in typescript</strong>. Or little bit of changes to make the Joi work exactly like in Javascript.</p>
  <p><strong>WHAT I TRIED</strong></p>
  <p><strong>validate.ts</strong></p>
  <pre><code>import * as Joi from &quot;joi&quot;;
  
  export const validateObject = (input: object) =&gt; {
  const schema = {
      home: Joi.string().required(),
    };
    return Joi.validate(input, schema);
  };
  validateObject({key:5})
  </code></pre>
  <p>While compiling, I got the error</p>
  <blockquote>
  <p>Cannot find name 'Iterable'.</p>
  <p>703     map(iterable: Iterable&lt;[string | number | boolean | symbol,
  symbol]&gt; | { [key: string]: symbol }): this;</p>
  </blockquote>
  <p><strong>UPDATE</strong><br />
  <strong>I have installed @types/joi as suggested in the answer but still the same error</strong></p>
  <p>I am basically looking for validating string,boolean,number,array and object keys as it can be done easily with Joi in Javascript</p>