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

WIP add useFileCompiler setting #616

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

Conversation

mheiber
Copy link

@mheiber mheiber commented May 28, 2019

enables getting type-checking
while enforcing --isolatedModules

fix
#613

enables getting type-checking
while enforcing --isolatedModules

fix
ivogabe#613
@@ -0,0 +1,12 @@
TypeScript error: test/useFileCompiler/excluded-dir/test.ts(1,1): error TS2304: Cannot find name 'notCompiled'.
Copy link
Author

Choose a reason for hiding this comment

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

please ignore these tests, they are a little borked right now

@mheiber
Copy link
Author

mheiber commented Jun 4, 2019

could use some advice on this: #613 (comment)

@ivogabe
Copy link
Owner

ivogabe commented Jun 4, 2019

Hi Max, thanks for your PR. Sorry, I have not yet had time to look at your work, O hope to do that this evening or tomorrow.

@mheiber
Copy link
Author

mheiber commented Jun 4, 2019

No rush, and thanks for your time

Copy link
Owner

@ivogabe ivogabe left a comment

Choose a reason for hiding this comment

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

Finally got some time to look at your PR, I have a few suggestions to make things easier. You only changed the createProject, but I would also want to adjust the main exported function. That function is defined here:

function compile(settings: compile.Settings, theReporter?: _reporter.Reporter): compile.CompileStream;

This function also takes a reporter, which we will need to move one position to the right. I think that the GulpTsSettings are used more often than the reporters. We cannot add Reporter to the GulpTsSettings interface, as that would not work with the createProject interface; the reporter is there namely passed in the gulp task, not at the creation of the project. The signature of the main export would then thus look like this:

function compile(settings?: compile.Settings, gulpTsSettings?: GulpTsSettings, theReporter?: _reporter.Reporter): compile.CompileStream;

You can remove the overload taking a project, as that API is deprecated and we can remove that in the next major release.

When we change that function as well, we assert that the typescript options is always passed in the gulpTsSettings parameter, not in the normal settings parameter. That will simplify getTypeScript as well, as that will then only take one argument. It will also simplify the documentation. Can you also make that change?

Regarding the tests, I think we get a time out as we run the test with several versions of TypeScript. We can drop some old versions and thus reduce the time to run the tests. I'll do that myself.

if (useFileCompiler && !options.isolatedModules) {
throw Error("useFileCompiler: true can only be used if config.compilerOptions.isolatedModules is also set to true");
}
let compiler: ICompiler;
Copy link
Owner

Choose a reason for hiding this comment

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

This should be indented with tabs

export function createProject(tsConfigFileName: string, settings?: Settings): Project;
export function createProject(settings?: Settings): Project;
export function createProject(fileNameOrSettings?: string | Settings, settings?: Settings): Project {
function _createProject({
Copy link
Owner

Choose a reason for hiding this comment

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

Normal arguments instead of an object, as you are giving all properties at both calls. So an object does not really add a value here.

@mheiber
Copy link
Author

mheiber commented Aug 16, 2019

closing, will reopen after incorporating changes

@mheiber mheiber closed this Aug 16, 2019
@ivogabe
Copy link
Owner

ivogabe commented Nov 10, 2019

Hi Max, have you had time to look into this? Or shall I proceed with this work?

@ivogabe ivogabe reopened this Nov 10, 2019
@mheiber
Copy link
Author

mheiber commented Nov 11, 2019

Apologies, I had to put this aside as we switched to a different solution. I can tidy this up next Sunday, but I understand if you would prefer to take over from here: whatever works.

Thanks again for your feedback!

@ivogabe
Copy link
Owner

ivogabe commented Nov 11, 2019

No problem, I also had some other things to do. No hurries, would be great if you could make some time next Sunday!

@mheiber
Copy link
Author

mheiber commented Nov 21, 2019

Hi @ivogabe , I'm sorry, but I think I'll have to orphan this PR.

It started with a single new flag, but triggered a large refactor of the public API that I'm having trouble fitting in my head, given all the overloads and optional arguments.

I'm no longer using gulp-typescript, so don't want to be a bad user that does a drive-by PR that has such cascading affects on tests, docs, and the future maintainability of the project.

Thanks for your work on gulp-typescript, and apologies for bailing!

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