Most likely no. The best solution that comes to my mind is wrapping an Object (or Map) with you custom class with methods set(key: string, val: any) and get(key: string) that can disallow adding new items to the underlying collection under certain circumstances.