Skip to content

Conversation

@tmulry
Copy link
Contributor

@tmulry tmulry commented Dec 19, 2017

I was getting this error on running tsc

singleton/src/demo.ts(6,38): error TS2339: Property 'Singleton' does not exist on type 'typeof SingletonPattern'. singleton/src/demo.ts(7,38): error TS2339: Property 'Singleton' does not exist on type 'typeof SingletonPattern'.

Added an export keyword and moved the singleton files up a directory. For some reason they were the only ones that use a src dir.

// A variable which stores the singleton object. Intially,
// the variable acts like a placeholder
private static singleton: Singleton = null;
// private constructor so that no instance is created
private constructor() {
}
// This is how we create a singleton object
public static getInstance(): Singleton {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the intent here to demo the typescript 'get' keyword?

@torokmark torokmark merged commit 9c653ca into torokmark:master Dec 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants