Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Enable TypeScript in Browser by One Line Configuration #2

Open
huan opened this issue Aug 3, 2016 · 0 comments
Open

Enable TypeScript in Browser by One Line Configuration #2

huan opened this issue Aug 3, 2016 · 0 comments
Assignees
Milestone

Comments

@huan
Copy link
Owner

huan commented Aug 3, 2016

When we want to run this typescript(with filename app/main.ts):

class Test {
  constructor() {
    console.log('Class Test constructor()')
  }
}

const t: Test
t = new Test()

I want to enable typescript in browser like this:

<script src='//npmcdn.com/pure-typescript'></script>
<script>
var pts = PureTypeScript('app/main.ts')
</script>

instead of this(need configure SystemJS), which I feel is too COMPLICATED!

<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script>
  System.config({
    transpiler: 'typescript'
    , typescriptOptions: { emitDecoratorMetadata: true }
    , packages: {'app': {defaultExtension: 'ts'}} 
  })
  System.import('app/main')
              .catch(console.error.bind(console))
</script>

Cheers.

@huan huan added this to the v0.2 milestone Aug 3, 2016
@huan huan self-assigned this Aug 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant