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

fix: 添加solid的taro-components的类型定义 & solid的默认模板配置 & createStore api开发环境下报错的问题 #16358

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: solid默认模板添加@tarojs/components类型定义
  • Loading branch information
phy-lei committed Aug 19, 2024
commit 2cd757885fcff76bf26344be243c099b4d7c4527
3 changes: 3 additions & 0 deletions packages/taro-cli/templates/default/template_creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const handler = {
'/types/vue.d.ts' (err, { framework, typescript }) {
return ['Vue3'].includes(framework) && !!typescript
},
'/types/solid.d.ts' (err, { framework, typescript }) {
return ['Solid'].includes(framework) && !!typescript
},
'/src/pages/index/index.jsx' (err, { pageDir = '', pageName = '', subPkg = '' }) {
return {
setPageName: normalizePath(path.join(PAGES_ENTRY, pageDir, pageName, 'index.jsx')),
Expand Down
5 changes: 3 additions & 2 deletions packages/taro-cli/templates/default/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
"strictNullChecks": true,
"sourceMap": true,
"rootDir": ".",
"jsx": "{{#if (includes "Vue3" s=framework)}}preserve{{else}}react-jsx{{/if}}",{{#if (eq framework "Preact") }}
"jsx": "{{#if (includes "Vue3" s=framework)}}preserve{{else if (eq framework 'Solid')}}preserve{{else}}react-jsx{{/if}}",{{#if (eq framework "Preact") }}
"skipLibCheck": true,{{/if}}
"allowJs": true,
"allowJs": true,{{#if (eq framework "Solid")}}
"jsxImportSource": "solid-js",{{/if}}
"resolveJsonModule": true,
"typeRoots": [
"node_modules/@types"
Expand Down
3 changes: 3 additions & 0 deletions packages/taro-cli/templates/default/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ declare namespace NodeJS {
{{#if (includes "Vue3" s=framework)}}
declare module '@tarojs/components' {
export * from '@tarojs/components/types/index.vue3'
}{{else if (includes "Solid" s=framework)}}
declare module '@tarojs/components' {
export * from '@tarojs/components/types/index.solid'
}{{/if}}
12 changes: 12 additions & 0 deletions packages/taro-cli/templates/default/types/solid.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export { }

declare module 'solid-js' {
namespace JSX {
interface Directives {
/** Note:如果需要定义自定义指令的类型,可以在这里做
* 参考官网文档https://docs.solidjs.com/reference/jsx-attributes/use
* model: [() => any, (v: any) => any]
*/
}
}
}
Loading