Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document usage #7

Open
iongion opened this issue Apr 3, 2015 · 4 comments
Open

Document usage #7

iongion opened this issue Apr 3, 2015 · 4 comments

Comments

@iongion
Copy link

iongion commented Apr 3, 2015

In my project I am using a custom typescript extension ".tsx" to denote those typescript source files with xml jsx tags.
Both react-tools compiler and jsx-typescript limit accepted extensions to .ts and .d.ts which in my opinion is a "forced" enforcement.
Do you have a sample on how to use the facilities in jsx-typescript to be able to compile a stream and not a file. I want to be able to compile my gulp streams using jsx-typescript.

@basarat
Copy link

basarat commented Apr 3, 2015

@ivogabe was looking at this support in https://www.npmjs.com/package/gulp-typescript

@iongion
Copy link
Author

iongion commented Apr 3, 2015

We tried using the pluggable compiler support in gulp-typescript but it fails with what is mentioned at issue #5

@fdecampredon
Copy link
Owner

I'll update This repo to ts 1.5 this weekend if I remember correctly ts 1.5 support non .ts extension

@englercj
Copy link

englercj commented May 8, 2015

How is this coming? Looks like if I use the jsx-dev branch I can almost get it to work by passing this in as the compiler for gulp-typescript. But I get errors, that suggest it doesn't recognize the XML O.o

import React from 'react';

interface Props { name: string; }

class _Something extends React.Component<Props, {}> {
    render() {
        return (
            <div id="wrapper">
                {this.props.name}
            </div>
        );
    }
}

export const Something = React.createClass(_Something.prototype);

Gives me these errors:

[13:15:04] Starting 'scripts:typescript'...
src\ts\templates\Something.ts(41,18): 1005 '>' expected.
src\ts\templates\Something.ts(41,20): 1005 ')' expected.
src\ts\templates\Something.ts(42,22): 1005 ':' expected.
src\ts\templates\Something.ts(57,15): 1161 Unterminated regular expression literal.
src\ts\templates\Something.ts(58,9): 1129 Statement expected.

Ignore the line numbers, but it seems like the XML parsing fails? Am I just using this wrong? All I am doing is passing it into gulp-typescript as the compiler to use:

var tsProject = ts.createProject('tsconfig.json', { typescript: require('jsx-typescript') });

return gulp.src(config.paths.scripts)
    .pipe(ts(tsProject)) 
    .js.pipe(gulp.dest(config.paths.temp + '/js'));

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

No branches or pull requests

4 participants