Unable to retrieve member information using Three.js in TypeScript

I am currently using three.d.ts from DefinitelyTyped along with TypeScript. Below is the code snippet I have:

class WoodStyle extends THREE.MeshBasicMaterial{
    putTexture(image: any){
        super.map=image;
    }
    constructor(){
        LoadImage().then(putTexture);
        super();
    }
}

In this code, I am loading an image and updating the material with the new image. However, during compilation, I encounter an error message saying:

2340 Only public and protected methods of the base class are accessible via the 'super' keyword
. Can anyone help me understand what I am doing wrong?

Answer №1

Remember to include this when accessing a inherited property:

class CustomMaterial extends THREE.MeshStandardMaterial{
    assignTexture(image: any){
        this.map=image;
    }
    constructor(){
        LoadImage().then(assignTexture);
        super();
    }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Determining the appropriate generic type in Typescript

In my code, there is a method designed to extend an existing key-value map with objects of the same type. This can be useful when working with database query results. export function extendWith< T extends { id: string | number }, O = | (T[" ...

Tips for optimizing image loading speed and enhancing website performance (Using React JS, GSAP, and Netlify)

My website is currently live on Netlify at the following URL: If you're interested, here's the Github link to the project: https://github.com/shindosu/mutsuki-portfolio-client A little background about the app - it's built with React JS. ...

Setting orientations for portrait and landscape views using Material UI breakpoints

Looking to implement portrait and landscape views for tablets using the styles object in Material UI. const tabletStyles = theme => ({ root: { padding: theme.spacing.unit, [theme.breakpoints.up('md')]: { backgroundColor: theme ...

Using Selenium to Perform Drag and Drop Operations on an SVG Object

I am attempting to drag a specific Webelement and drop it inside an SVG "container" that contains four elements, which are represented by polygons. Each polygon is labeled as g[1], g[2], and so on. Here is the HTML code of the container: <div class=&qu ...

If an Angular reactive form component has a particular value

I am working with a group of radio buttons. When a user chooses the option "yes," I would like to display an additional input box on the form. Link to Code Example HTML.component <div formGroupName="radioButtonsGroup" class="form-group col-6 pl-0 pt- ...

Insert text into the cursor location within Summernote using JQuery

Currently, I am working on a flutter application where I have implemented the summernote editor using JQuery. ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); String txtIsi = data.text .replaceAll("'", '\&bsol ...

Error: The value assigned to 'userid' is undefined and cannot be read

i encountered an error message saying "TypeError: Cannot read property 'userid' of undefined" here is the controller code snippet: .controller('tambahTemanCtrl',function($scope,$ionicPopup,temanService){ $scope.showAlert = function(ms ...

React-Enabled Chat Engine API for Seamless Customer Support

Chat Engine io is the API I am currently working with. It allows you to integrate chat rooms into your application. I have developed an application with a support chat feature where the admin can communicate with users by entering their email. Despite mul ...

Patience is key when programming automated scrolling with Selenium or Protractor

My application features a button that, when clicked, uses JavaScript to scroll the page. However, I'm encountering an error stating "Element is not clickable at point (somepoint,somepoint)". I believe this issue arises because selenium/protractor does ...

The 'posts' binding element is assumed to have a type of 'any' by default

Currently, I'm working on a code project that involves graphql, react, and typescript. In the middle of the process, I encountered an error message stating "Binding element 'posts' implicitly has an 'any' type." I am unsure about w ...

Tips for transferring the ID from one element to another using JavaScript

I'm attempting to create a slideshow using icons all within one class. The "active" style class will have an ID and represent the current picture. By clicking either the left or right button, I aim to change the style of the active class. const l ...

What is the best way to integrate Sass into a Create-React-App project that is using TypeScript

After setting up a new project using create-react-app and typescript, I included a sass file in my project as per the documentation (which mentioned built-in support for sass files). However, when trying to compile, I encountered the following error relate ...

When using Three.js raycaster to intersect objects, it may not function properly if THREE.Points contains only one vertex or if the vertices are arranged in a straight line

I've spent quite a bit of time trying to figure out this issue. It seems that the raycaster.intersectObject( pointCloud ); method does not intersect my 'pointCloud' Object when it only has one vertex in its position array attribute with thre ...

We were unable to locate the requested resource

I have been working on setting up an Express endpoint to fetch comments or reviews of a movie based on the movie ID. In my initial route, I manually passed the ID and retrieved data from TheMovieDB. However, I wanted to make this process dynamic in my seco ...

Is it possible to pass a component into a dialogue box in material-ui using React?

Hello, I am currently facing an issue with displaying a chart component within a dialogue box. Despite having the code in place, the chart is not rendering inside the dialogue box as expected. Unfortunately, due to the complexity of the code, I am unable t ...

What causes the error "property does not exist on type" when using object destructuring?

Why am I encountering an error in TypeScript when using Object destructuring? The JavaScript code executes without any issues, but TypeScript is showing errors. fn error: This expression is not callable. Not all elements of type '(() => void) | ...

Unit test failing due to Vue v-model binding not functioning as expected

I am attempting to monitor the value of the #username element when I change the data in form.username // Regitser.vue ... <div class="form-group"> <label for="username">Username</label> <input type="text ...

The labels on the bar graph ticks are failing to update in d3.js when the data is modified

My complete working code is below: const outerWidth = 600; const outerHeight = 300; const margin = 60; const height = outerHeight - 2*margin; const width = outerWidth - 2*margin; var data = [ { group: 'A', value: 5 }, { group: 'B', ...

What is the best method for sending a query string to my Angular 6 service?

My component currently calls a service in the following way: this.resultService.getResults().subscribe( results => { this.results = results; this.searchResults = results.SearchResults; this.searchResults = this.processRes ...

Displaying the items in ng-repeat using Laravel in AngularJS

I have been encountering difficulties displaying the contents of ng-repeat while working with Laravel 5.2. If you haven't tried this before, let me explain that when using double curly braces (e.g. {{ value }}) in Angular controllers within Laravel, ...