goatslacker / goatslacker/alt

issue with typescript definition file

Open
#477 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
312
PR merge metrics
No merged PRs in 30d

Description

I am using the alt typescript definition file and running into issues with the `actions` field of the `AltJS.ActionsClass`.

Here is what my code looks like:

```
class AbstractActions implements AltJS.ActionsClass {
constructor(alt:AltJS.Alt){}
dispatch: ( ...payload:Array) => void;
actions:AltJS.Actions;
}

interface IRedditActions {
fetchPosts();
}

export class RedditActions extends AbstractActions implements IRedditActions {

fetchPosts() {
this.dispatch();

RedditActions.fetchData().then((data)=> {
this.actions.updatePosts(data);
});
}

updatePosts(posts) {
this.dispatch(posts);
}
}
```

However, on this line:

```
this.actions.updatePosts(data);
```

I get this error:

```
Property 'updatePosts' does not exist on type `{ [action:string]: Action; }`
```

Is there anything I am doing wrong?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.