-
Notifications
You must be signed in to change notification settings - Fork 130
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
Allow type-checking when --isolatedModules specified: can PR for this change #613
Comments
pinging @ivogabe about this: we have code for this mostly done, but want to verify the approach and naming. Really appreciate your time if you could take a look, this change would really help us. |
ping @ivogabe |
Hi Max, sorry for the delay. I think it's a good idea to change it like you propose. For the API, I'd like to also integrate the 'typescript' option (https://github.com/ivogabe/gulp-typescript/tree/d0410c2dc37cd4259689e4bc354a8ec68e779823#typescript-version) in the export function createProject(settings?: Settings, gulpTsSettings?: GulpTsSettings): Project;
export function createProject(fileName: string, settings?: Settings, gulpTsSettings?: GulpTsSettings): Project; For users which do not use the createProject interface, we should modify the main export ( Line 8 in d0410c2
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. Great that you want to create a PR for this! Let me know if you need any help. |
Hi @ivogabe thanks very much for getting back to me and taking the time to put together this guidance. I return from holiday next week and can put something together then. If you need something sooner, please ping me here and I'll see what I can do. |
Looks like I'll have bandwidth to work on this this week. |
Working on this intermittently today. The overloads got complicated, so I'm thinking of separating the 'figuring out which overload we are in' logic from the implementation of createProject. export function createProject(): Project;
export function createProject(tsConfigFileName: string, settings?: Settings, gulpTsSettings?: GulpTsSettings): Project;
export function createProject(settings: Settings, gulpTsSettings?: GulpTsSettings): Project;
export function createProject(fileNameOrSettings?: string | Settings, settingsOrGulpTsSettings?: Settings | GulpTsSettings, gulpTsSettingsParam?: GulpTsSettings): Project {
// overload: createProject()
if (!fileNameOrSettings) {
return _createProject({
fileName: undefined,
settings: {},
gulpTsSettings: {}
});
}
// overload: createProject(tsConfigFileName, settings, gulpTsSettings)
if (typeof fileNameOrSettings === 'string') {
return _createProject({
fileName: fileNameOrSettings,
settings: settingsOrGulpTsSettings || {},
gulpTsSettings: gulpTsSettingsParam || {} }
);
}
// overload: createProject(settings, gulpTsSettings)
return _createProject({
fileName: undefined,
settings: fileNameOrSettings || {},
gulpTsSettings: settingsOrGulpTsSettings as GulpTsSettings || {} }
);
} |
The first overload can be removed, as it is already handled by the last overload. You only need to mark the export function createProject(tsConfigFileName: string, settings?: Settings, gulpTsSettings?: GulpTsSettings): Project;
export function createProject(settings?: Settings, gulpTsSettings?: GulpTsSettings): Project;
export function createProject(fileNameOrSettings?: string | Settings, settingsOrGulpTsSettings?: Settings | GulpTsSettings, gulpTsSettingsParam?: GulpTsSettings): Project {
// overload: createProject(tsConfigFileName, settings, gulpTsSettings)
if (typeof fileNameOrSettings === 'string') {
return _createProject({
fileName: fileNameOrSettings,
settings: settingsOrGulpTsSettings || {},
gulpTsSettings: gulpTsSettingsParam || {} }
);
}
// overload: createProject(settings, gulpTsSettings)
return _createProject({
fileName: undefined,
settings: fileNameOrSettings || {},
gulpTsSettings: settingsOrGulpTsSettings as GulpTsSettings || {} }
);
} |
enables getting type-checking while enforcing --isolatedModules fix ivogabe#613
enables getting type-checking while enforcing --isolatedModules fix ivogabe#613
I know it's been a long time. |
Expected behavior:
There is a way to get type-checking while using --isolatedModules
Actual behavior:
when passing --isolatedModules no type-checking is done. This is by design, but we want a way to get the same behavior as tsc, where --isolatedModules checks that separate compilation si safe, but doesn't actually do separate compilation.
Your gulpfile:
Include your gulpfile, or only the related task (with
ts.createProject
).tsconfig.json
Code
Include your TypeScript code, if necessary.
Suggestion Implementation: new
GulpTsSettings
with keyuseFileCompiler
:Happy to make a PR for this change. Sketch of implementation:
main.ts
project.ts
The text was updated successfully, but these errors were encountered: