# @types/p5 not find like class in typeScript

**URL:** <https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475>\
**Category:** Coding Questions\
**Created:** [March 20, 2019, 12:58pm UTC](https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475 "2019-03-20T12:58:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stanlepunk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/stanlepunk/32/11509_2.png) [@Stanlepunk](https://discourse.processing.org/u/Stanlepunk)\
**Post date:** [March 20, 2019, 12:58pm UTC](https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475/1 "2019-03-20T12:58:54Z")

</div>

I download the last version of `P5` types for `TypeScript`.  
I place it in the node folder, when I use importation the folder is detected but after when I try to implement p5 in the class, Sublim Text say the class is not found. Sure I miss something but what???

 ![45](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/752461fb6598b6cc4233ab6e1f8b973dd9fc7cbc.png) ![45](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c488b9e2e5ea7ea8f8c9dc7ed6d51bb5e61c9463.png)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [March 20, 2019, 6:19pm UTC](https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475/2 "2019-03-20T18:19:46Z")

</div>

- I’ve barely touched p5js under TS.
- Maybe create a “typings” subfolder and place the “p5.d.ts” file there as I did here:  
[GitHub.com/GoSubRoutine/Ball-in-the-Chamber/tree/master/instance/typings](http://GitHub.com/GoSubRoutine/Ball-in-the-Chamber/tree/master/instance/typings)
- You might also try out a direct reference: `///<reference path="typings/p5.d.ts"/>`

> <https://github.com/GoSubRoutine/Ball-in-the-Chamber/blob/master/global/sketch.ts>

---

<div class="post-metadata">

**Author:** ![Stanlepunk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/stanlepunk/32/11509_2.png) [@Stanlepunk](https://discourse.processing.org/u/Stanlepunk)\
**Post date:** [March 21, 2019, 8:33am UTC](https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475/3 "2019-03-21T08:33:18Z")

</div>

In my old version, I make something like write, and that’s work. But it’s a old file `types`. I want use a the latest P5 version, download from `npm`and when read the instruction i’ve a feeling the folder `p5`must add in the 'node-module`and the organisation of type file file is completetly different, plus when I put the folder`types` where it work before that’s don’t work ☹

older style that’s work 🙂

 ![16](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/719cfb689d3e38965d9da675eac74174256a55a9.png)

new style with newest types version that’s don’t work

 ![29](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/46cff01c4b7a45754e86862449114fb67f7e4453.jpeg)

I try try different path and different place for folder but that’s don’t work.

```auto
import Position from './Z_Position'
//import * as _ from "p5";
////<reference path="./node_modules/@types/p5/index.d.ts"/>
////<reference path="./types/p5/index.d.ts"/>
///<reference path="types/p5/index.d.ts"/>

```

the file index there is `class p5` so i suppose i must target this file to start ?

---

<div class="post-metadata">

**Author:** ![Stanlepunk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/stanlepunk/32/11509_2.png) [@Stanlepunk](https://discourse.processing.org/u/Stanlepunk)\
**Post date:** [March 22, 2019, 8:48am UTC](https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475/4 "2019-03-22T08:48:37Z")

</div>

@ [julian2](https://discourse.processing.org/u/julian2) hello, when i posted my starting work about typeScript I see you’re sensitive to `node` `webpack` so may be you’ve an idea about my new problem? 🙂

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [March 24, 2019, 6:18am UTC](https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475/5 "2019-03-24T06:18:25Z")

</div>

@Stanlepunk, if you’re still interested, I’ve refactored my “Ball-in-the-Chamber” TS sketch to use `@types/p5`: 🥳

> **[GoSubRoutine/Ball-in-the-Chamber](https://github.com/GoSubRoutine/Ball-in-the-Chamber)**
>
> Contribute to GoSubRoutine/Ball-in-the-Chamber development by creating an account on GitHub.

I had to convert the whole instance mode sketch version from using TS namespaces to ESNext browser native modules in order to work w/ `@types/p5` though. But it was worth it! 😅

---

<div class="post-metadata">

**Author:** ![Stanlepunk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/stanlepunk/32/11509_2.png) [@Stanlepunk](https://discourse.processing.org/u/Stanlepunk)\
**Post date:** [March 24, 2019, 9:29am UTC](https://discourse.processing.org/t/types-p5-not-find-like-class-in-typescript/9475/6 "2019-03-24T09:29:09Z")

</div>

@GoToLoop That’s sound good, I look at asap when my hangover will be go out !
