Is there such a thing as public static constants in TypeScript? I have a class that looks like:
export class Library {
public static BOOK_SHELF_NONE: stri
Just simply 'export' variable and 'import' in your class
export var GOOGLE_API_URL = 'https://www.googleapis.com/admin/directory/v1';
// default err string message
export var errStringMsg = 'Something went wrong';
Now use it as,
import appConstants = require('../core/AppSettings');
console.log(appConstants.errStringMsg);
console.log(appConstants.GOOGLE_API_URL);
You can do it using namespaces, like this:
export namespace Library {
export const BOOK_SHELF_NONE: string = 'NONE';
}
Then you can import it from anywhere else:
import {Library} from './Library';
console.log(Library.BOOK_SHELF_NONE);
If you need a class there as well include it inside the namespace: export class Book {...}