# Babylon.JS & TypeScript - Inherited members not visible on derived classes?

**URL:** <https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206>\
**Category:** Questions\
**Tags:** vscode, typescript, es6\
**Created:** [May 2, 2025, 10:36am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206 "2025-05-02T10:36:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteffanDonal](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/steffandonal/32/46375_2.png) [@SteffanDonal](https://forum.babylonjs.com/u/SteffanDonal)\
**Post date:** [May 2, 2025, 10:36am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/1 "2025-05-02T10:36:42Z")

</div>

Hello, thanks for popping in to help.

### Context:

> I’ve just started using Babylon.JS with TypeScript. I’m reasonably comfortable with TypeScript syntax and expectations, but there’s a solid chance I’m missing something simple or obvious; I don’t have native common sense yet!
> 
> I have plenty of experience with type-safe languages however.

### Problem:

I’ve been having trouble accessing inherited members, with TypeScript spitting out errors like:

```ts
(thing as Texture).readPixels();
    // Property 'readPixels' does not exist on type 'Texture'. ts(2339)

(thing as BaseTexture).getSize();
    // Property 'getSize' does not exist on type 'BaseTexture'. ts(2339)

```

**Edit** : _This is Visual Studio Code’s TypeScript language support, my project does build and run as expected._

I’ve been researching other threads and found cases where (for example) a user is attempting to access `material.albedoTexture`, where `material is Material` and so the `albedoTexture` property is not visible without a cast.  
The type is boxed; this behavior is inline with my expectations of type-safe languages.

However in my case, these inherited members should be known to exist statically, and are “safe”.  
Is it really expected that I perform casts to base classes when accessing inherited members?

Could I be missing something here?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 2, 2025, 10:46am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/2 "2025-05-02T10:46:53Z")

</div>

Hey,  
This is quite interesting. Casting to `Texture` should get you the function you are looking for, especially since `readPixels` is available in the BaseTexture class, which is a parent of the Texture class.

Would you be able to somehow reproduce this in a shared project? Something I can load locally and check myself?

---

<div class="post-metadata">

**Author:** ![SteffanDonal](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/steffandonal/32/46375_2.png) [@SteffanDonal](https://forum.babylonjs.com/u/SteffanDonal)\
**Post date:** [May 2, 2025, 10:59am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/3 "2025-05-02T10:59:09Z")

</div>

Ah, my apologies:  
Upon further investigation, it seems that the error I’m seeing is coming from Visual Studio Code’s TypeScript language service.

I’m not actually seeing any errors when the project is built, either for development or production, so that’s good at least.

I will prepare a reproduction repo all the same!

---

<div class="post-metadata">

**Author:** ![SteffanDonal](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/steffandonal/32/46375_2.png) [@SteffanDonal](https://forum.babylonjs.com/u/SteffanDonal)\
**Post date:** [May 2, 2025, 11:19am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/4 "2025-05-02T11:19:13Z")

</div>

Reproduction repository here: [GitHub - SteffanDonal/typescript-inherited-members-fun](https://github.com/SteffanDonal/typescript-inherited-members-fun)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 2, 2025, 11:32am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/5 "2025-05-02T11:32:56Z")

</div>

i’ll check it later today

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 2, 2025, 11:34am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/6 "2025-05-02T11:34:44Z")

</div>

Oh, just one thing - I noticed you are using an older version of the framework (7.49) with nodenext as module resolution in your tsconfig.  
We added support for nodenext, but only after 8 was released. Can you try with a later version of the framework? or move to node module resolution in your tsconfig?

---

<div class="post-metadata">

**Author:** ![SteffanDonal](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/steffandonal/32/46375_2.png) [@SteffanDonal](https://forum.babylonjs.com/u/SteffanDonal)\
**Post date:** [May 2, 2025, 11:40am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/7 "2025-05-02T11:40:25Z")

</div>

I can confirm, updating to version `8.5` fixed the issue - thank you!

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 2, 2025, 11:47am UTC](https://forum.babylonjs.com/t/babylon-js-typescript-inherited-members-not-visible-on-derived-classes/58206/8 "2025-05-02T11:47:16Z")

</div>

great!! love to hear that.
