create-react-app-typescript icon indicating copy to clipboard operation
create-react-app-typescript copied to clipboard

Add documentation detailing differences between CRA 2.0 and CRA-TS

Open hassankhan opened this issue 7 years ago • 10 comments

It would be nice to list the main differences between the two projects, since there is quite a lot of overlapping functionality and can be somewhat confusing to developers who need to make a decision.

Here's what I have so far:

CRA-TS CRA 2.1.1
Namespaces
baseUrl/paths
Casting with <Type>expression
Type-Checking Same process Separate process
Transpilation TypeScript Babel

hassankhan avatar Oct 31 '18 13:10 hassankhan

I believe the correct CRA version is 2.1. Also one more difference to add could be that in CRA 2.1 you can't use <Type>expression to cast, only expression as Type. Which is a super minor thing as you can't use it in TSX anyway so it only applies to TS files which I believe are usually in a minority in React based TS projects.

ghost avatar Oct 31 '18 14:10 ghost

Thanks @tomashubelbauermicrosoft, I've updated the table above. Do you think its worth mentioning the differences from here too?

hassankhan avatar Oct 31 '18 16:10 hassankhan

Decorators won' bet supported until CRA 2.1.1: https://github.com/facebook/create-react-app/issues/5642

EDIT: Now fixed and released as CRA 2.1.1.

ghost avatar Oct 31 '18 17:10 ghost

What are the implications of using Babel vs tsc for transpilation?

doxxx avatar Nov 01 '18 17:11 doxxx

@doxxx Namespaces and casting

dkozickis avatar Nov 02 '18 21:11 dkozickis

I think we should include babel-loader for typescript files as well because of the super handy babel-plugin-macros. Or perhaps do it opt-in somehow.

danielkcz avatar Nov 02 '18 21:11 danielkcz

@dkozickis After doing some reading, it would seem that one of the other implications is that Babel 7 doesn't actually do any type-checking of Typescript code, it just transpiles it down to Javascript. If you want type-checking, you still have to run tsc.

doxxx avatar Nov 04 '18 01:11 doxxx

Just tried out CRA 2.1.0. Looks like linting is based on eslint. And there is too much mismatch between vscode dev environment and linting errors. There is no eslint config file created to customize anything. And I felt documentation was lacking wrt linting in general.

CRA-TS does it perfectly for me. If the console shows an error, vscode shows it too.

shobhitg avatar Nov 04 '18 10:11 shobhitg

@doxxx I thought I'd read that somewhere too, but can't seem to find any links 😕. If you could post one, that would be awesome 👍

hassankhan avatar Nov 04 '18 12:11 hassankhan

@hassankhan https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/

doxxx avatar Nov 04 '18 13:11 doxxx