Skip to content

Conversation

@mwand
Copy link
Collaborator

@mwand mwand commented Aug 6, 2020

Here is my version of abstractfactory.

Look at the text I wrote at the top of index.ts and explodingroom.ts . You may find that helpful.

In explodingroom.ts, I added a second implementation of the factory: one built "from scratch", and one built by inheritance. I put some explanation about the relationship between AbstractFactory and the use of inheritance to build new factories. See if you like it.

I was unable to standardize on "export default" because (a) I couldn't figure out the syntax for exporting more than one value from a file and (b) when I tried to export an interface, TS complained that it was not possible to export a type.

I also got a nasty type error which turned out to be because I was importing one thing from a file, and the default export was something else.

So the code standardizes on locally declaring exports, and then importing

import {Foo, Bar} from './whatever'

I suspect that the True TypeScript way is to say

import * as what from './whatever/
and then writing
what.Foo and what.Bar

But I don't assert that with much confidence.

Enjoy!
--Mitch

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.

3 participants