Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PresetManager methods not declared as static in gantt.d.ts #136

Closed
jsakalos opened this issue Dec 29, 2019 · 1 comment
Closed

PresetManager methods not declared as static in gantt.d.ts #136

jsakalos opened this issue Dec 29, 2019 · 1 comment
Assignees
Labels
angular Angular framework integration bug Something isn't working resolved Fixed but not yet released (available in the nightly builds)
Milestone

Comments

@jsakalos
Copy link

Reported here: https://www.bryntum.com/forum/viewtopic.php?f=44&t=12958#p67760

PresetManager is a singleton but its methods are not declared as static in gantt.d.ts:

export class PresetManager extends PresetStore {  
        registerPreset(id: string, config: object): ViewPreset;
        normalizePreset(presetOrId: string|object): ViewPreset;
        deletePreset(id: string): void;
    }

The result is that TypeScript does not find these methods:

Screen Shot 2019-12-29 at 22 23 03

@jsakalos jsakalos added bug Something isn't working angular Angular framework integration labels Dec 29, 2019
@jsakalos jsakalos changed the title PresetManager method not declared as static in gantt.d.ts PresetManager methods not declared as static in gantt.d.ts Dec 29, 2019
@matsbryntse matsbryntse added this to the Scheduler 3.0.1 milestone Jan 4, 2020
@jsakalos
Copy link
Author

jsakalos commented Jan 6, 2020

This is deeper seated than I originally thought. The problem here is that for singletons we create instances of the classes but the documentation is written for class definitions. Typescript however, does not know that we have created the instance of the class and, because the methods are not originally static, it does not recognize the singleton methods.

In other words:

import { PresetManager } from 'bryntum-scheduler'; // imports PresetManager instance

PresetManager.registerLocale(...) // typescript thinks that we're working with the PresetManager class

We would need:

    export class PresetManager extends PresetStore {        
        static registerPreset(id: string, config: object): ViewPreset;
        static normalizePreset(presetOrId: string|object): ViewPreset;
        static deletePreset(id: string): void;
    }

in scheduler.d.ts however without really declaring singleton methods as statics.

All singletons (e.g. LocaleManager) are affected by this.

@matsbryntse matsbryntse removed their assignment Jan 8, 2020
@jsakalos jsakalos added the ready for review Issue is fixed, the pull request is being reviewed label Jan 8, 2020
@matsbryntse matsbryntse added resolved Fixed but not yet released (available in the nightly builds) and removed ready for review Issue is fixed, the pull request is being reviewed labels Jan 15, 2020
@SergeyMaltsev SergeyMaltsev modified the milestones: Scheduler 3.0.1, 3.0.1 Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
angular Angular framework integration bug Something isn't working resolved Fixed but not yet released (available in the nightly builds)
Projects
None yet
Development

No branches or pull requests

4 participants