Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

feat: enhance framework types #545

Merged
merged 2 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 1 addition & 14 deletions examples/app-config/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/app-config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
1 change: 0 additions & 1 deletion examples/basic-project/src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Link, useData, useConfig, history } from 'ice';
import { isWeb } from '@uni/env';
// @ts-expect-error
import url from './ice.png';

interface Data {
Expand Down
15 changes: 1 addition & 14 deletions examples/basic-project/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/basic-project/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/csr-project/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/csr-project/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/rax-inline-style/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/rax-inline-style/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/rax-project/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/rax-project/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
5 changes: 1 addition & 4 deletions examples/with-antd-mobile/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/with-antd-mobile/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/with-antd/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/with-antd/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/with-fusion/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/with-fusion/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/with-pha/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/with-pha/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
15 changes: 1 addition & 14 deletions examples/with-plugin-request/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}
/// <reference types="@ice/app/types" />
2 changes: 1 addition & 1 deletion examples/with-plugin-request/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"include": ["src", ".ice", "ice.config.*"],
"exclude": ["node_modules", "build", "public"]
"exclude": ["build", "public"]
}
3 changes: 2 additions & 1 deletion packages/ice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"esm",
"!esm/**/*.map",
"templates",
"openChrome.applescript"
"openChrome.applescript",
"types.d.ts"
],
"engines": {
"node": ">=14.19.0",
Expand Down
150 changes: 150 additions & 0 deletions packages/ice/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// CSS modules
declare module '*.module.less' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.module.scss' {
const classes: { [key: string]: string };
export default classes;
}

// images
declare module '*.jpg' {
const src: string;
export default src;
}
declare module '*.jpeg' {
const src: string;
export default src;
}
declare module '*.png' {
const src: string;
export default src;
}
declare module '*.gif' {
const src: string;
export default src;
}
declare module '*.svg' {
const src: string;
export default src;
}
declare module '*.ico' {
const src: string;
export default src;
}
declare module '*.webp' {
const src: string;
export default src;
}
declare module '*.avif' {
const src: string;
export default src;
}

// media
declare module '*.mp4' {
const src: string;
export default src;
}
declare module '*.webm' {
const src: string;
export default src;
}
declare module '*.ogg' {
const src: string;
export default src;
}
declare module '*.mp3' {
const src: string;
export default src;
}
declare module '*.wav' {
const src: string;
export default src;
}
declare module '*.flac' {
const src: string;
export default src;
}
declare module '*.aac' {
const src: string;
export default src;
}

// fonts
declare module '*.woff' {
const src: string;
export default src;
}
declare module '*.woff2' {
const src: string;
export default src;
}
declare module '*.eot' {
const src: string;
export default src;
}
declare module '*.ttf' {
const src: string;
export default src;
}
declare module '*.otf' {
const src: string;
export default src;
}

// web worker
declare module '*?worker' {
const workerConstructor: {
new(): Worker;
};
export default workerConstructor;
}
declare module '*?worker&inline' {
const workerConstructor: {
new(): Worker;
};
export default workerConstructor;
}
declare module '*?sharedworker' {
const sharedWorkerConstructor: {
new(): SharedWorker;
};
export default sharedWorkerConstructor;
}

// other
declare module '*.pdf' {
const src: string;
export default src;
}
declare module '*.txt' {
const src: string;
export default src;
}
declare module '*?url' {
const src: string;
export default src;
}
declare module '*?raw' {
const src: string;
export default src;
}

declare namespace NodeJS {
export interface ProcessEnv {
ICE_CORE_NODE_ENV: 'development' | 'production';
ICE_CORE_MODE: string;
ICE_CORE_ROUTER: 'true' | 'false';
ICE_CORE_ERROR_BOUNDARY: 'true' | 'false';
ICE_CORE_INITIAL_DATA: 'true' | 'false';
ICE_CORE_DEV_PORT: number;
}
}