'static class function scope in npm package
I have two typescript npm packages build with webpack.
A simplified example:
First package AA has a class A with a static list: {id: string}[] = [];
export class A {
static list: {id: string}[] = [];
}
Second package BB uses A.list.push({id: 'fromBB'});
The Main application imports both packages AA and BB and i add A.list.push({id: 'fromMain'}); .
If i log A.list from Main, i only have one entry "fromMain" and "fromBB" is missing.
If i log A.list from BB, i only have one entry "fromBB" and "fromMain" is missing.
I think it's a hoisting problem and i don't knowhow to solve this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
