# Blender exporter Materials to PBRMaterials Typescript type conflict

**URL:** <https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578>\
**Category:** Bugs\
**Created:** [December 13, 2019, 2:35pm UTC](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578 "2019-12-13T14:35:33Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![peterimg](https://avatars.discourse-cdn.com/v4/letter/p/50afbb/32.png) [@peterimg](https://forum.babylonjs.com/u/peterimg)\
**Post date:** [December 18, 2019, 2:50pm UTC](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578/22 "2019-12-18T14:50:41Z")

</div>

Generics ??

That was my initial suggestion 🙂

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 18, 2019, 2:57pm UTC](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578/23 "2019-12-18T14:57:40Z")

</div>

This would not change anything as the list contains a mix of materials. You will still need to cast at some points to filter. As this would force to duplicate the list or use generators not supported on every browsers there is nothing we should change on our side that i am aware of in ts if you do please make a PR so that we could discuss it.

---

<div class="post-metadata">

**Author:** ![peterimg](https://avatars.discourse-cdn.com/v4/letter/p/50afbb/32.png) [@peterimg](https://forum.babylonjs.com/u/peterimg)\
**Post date:** [December 18, 2019, 3:00pm UTC](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578/24 "2019-12-18T15:00:14Z")

</div>

I do not have time to make a pr and look at your code. Thats why I’m reporting this to you. Im not a creator. I’m a user of Babylon.

That will make me do a type check but not a type cast.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 18, 2019, 3:43pm UTC](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578/25 "2019-12-18T15:43:53Z")

</div>

If you just want type checking, you know that this works already ?

```auto
for (let i = 0; i < scene.materials.length; i += 1) {
  const m = scene.materials[i];
  if (m instanceof PBRMaterial) {
    m.ambientColor = null;
  }
}

```

This would work in your case and is similar to the cast but through type inference it is just a syntax difference… and does not change how the code runs.

The only diff is perf hence the proposal with getClassName() but it is all on your side and nothing to change in Babylon.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [December 18, 2019, 3:47pm UTC](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578/26 "2019-12-18T15:47:14Z")

</div>

> [@peterimg](#):
>
> I think you are the first person who understand the issue.

Seriously, you will have to be REALLY cautious with this kind of comment. Like REALLY REALLY…

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [December 18, 2019, 3:48pm UTC](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578/27 "2019-12-18T15:48:29Z")

</div>

> [@sebavan](#):
>
> If you just want type checking, you know that this works already ?

No he does not because he is not listening…

[Previous page](https://forum.babylonjs.com/t/blender-exporter-materials-to-pbrmaterials-typescript-type-conflict/7578.md?page=1)
