Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

[WIP] unsafe path methods #51

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

[WIP] unsafe path methods #51

wants to merge 5 commits into from

Conversation

dwickern
Copy link
Collaborator

@dwickern dwickern commented Sep 19, 2017

I threw together a proof of concept from our discussion today. Any path related APIs accept a keyof now, and you can opt into an unsafe version which takes a string.

I'm not sure how we would deploy something like this.

@chriskrycho
Copy link
Member

I think the best way to deploy it would probably be as an optional dependency. We could (a) create a standalone package for it (like ember-unsafe-typings) or (b) install it by default for a while with ember-cli-typescript – just put it at <app>/typings/unsafe-ember and then… do a meaningless import somewhere with a comment explaining what it's for? Add it to application.ts or something?

In (a) we'd document how to opt into the unsafe typings; in (b) we'd document how to opt out. I prefer (b) between those two because it allows for the gradual typing approach, as we all noted in Slack.

@dwickern
Copy link
Collaborator Author

I wonder if DT would accept typings for a nonexistent module. Do we need to squat ember-unsafe-typings?

@dfreeman
Copy link
Member

dfreeman commented Sep 19, 2017

Does DT need to be involved at all? Could ember-unsafe-typings just be a published package with a types field in its package.json?

@dwickern
Copy link
Collaborator Author

True, we could publish a package with only typings, no code, and enable it with import 'ember-unsafe-typings'. I'd have to test if that can work

@dwickern
Copy link
Collaborator Author

I tested this out, it worked perfectly

@chriskrycho
Copy link
Member

Let's do it.

@dwickern
Copy link
Collaborator Author

ember-unsafe-typings is mostly working. I copied over the tests from this PR. The "test suite" simply calls tsc.

You'll have a runtime error when you import the nonexistent module from an ember app. I need to set up a vendor shim or remove the import somehow at build time.

@chriskrycho
Copy link
Member

@dwickern do we want to come back and pick this up and publish it? I think it's still valuable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants