title: How to create type definitions in your local project for a javascript library?
body: <p>I'm trying to use the <a href="https://github.com/rdfjs/N3.js" rel="nofollow noreferrer">N3</a> library in a typescript project. The example javascript code on the README looks like this. </p>
  
  <pre><code>const N3 = require('n3');
  const { DataFactory } = N3;
  const { namedNode, literal, defaultGraph, quad } = DataFactory;
  const myQuad = quad(
    namedNode('https://ruben.verborgh.org/profile/#me'),
    namedNode('http://xmlns.com/foaf/0.1/givenName'),
    literal('Ruben', 'en'),
    defaultGraph(),
  );
  </code></pre>
  
  <p>In typescript I'm stuck at the first step. In the root of my project I have a file named main.ts with the following. </p>
  
  <pre><code>import * as N3 from "n3";
  </code></pre>
  
  <p>But I get an error "Could not find a declaration file for module 'n3'"</p>
  
  <p>Here's where I'm stuck. The type definitions in DefinitelyTyped are old and out of date so I can't use them. I'm trying to create my own type definitions for the library, but I can't figure out how to do this. Is it possible to create a type definition file that resides in my local project (i.e. not in node_modules?). I've tried to do this in several ways without success. Is there a way to do this? What is the right way to handle this situation? </p>