Reputation: 3531
As far as I know, Svelte is written in JavaScript with JSDoc.
I'd like to learn Svelte and prefer to use JSDoc. When initialising a project with npm create svelte@latest
, I'm asked the following:
◆ Add type checking with TypeScript?
│ ● Yes, using JavaScript with JSDoc comments
│ ○ Yes, using TypeScript syntax
│ ○ No
└
My first instict was to select Yes, using JavaScript with JSDoc comments
, but then I saw the question was Add type checking with TypeScript?
What does JavaScript with JSDoc have to do with TypeScript? Why does Svelte offer this weird combination of TypeScript with JavaScript and JSDoc?
And would I have to select No, when I want to use pure JavaScript with JSDoc?
Upvotes: 1
Views: 612
Reputation: 185280
If you choose "Yes, using JavaScript with JSDoc comments" it will set up:
jsconfig.json
which configures TypeScript to check JS files ("strict"
, "allowJs"
, "checkJs"
, etc.).package.json
which can be used to check components.check
or check:watch
to ensure type safety in component code.If you select "No" you just get the default checks provided by whatever IDE/extensions you are using.
Upvotes: 0