mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
Fix TypeScript definitions; function declarations should be typed as accessors, not props (#740)
* chore(deps-dev): upgrade svelte to v0.8.1 * chore: regenerate types to correctly type function declarations * test: fix svelte-check warnings
This commit is contained in:
parent
b6fa25c3e7
commit
18c6f03224
9 changed files with 951 additions and 22 deletions
File diff suppressed because it is too large
Load diff
|
@ -43,7 +43,7 @@
|
|||
"rollup-plugin-svelte": "^7.1.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"sass": "^1.32.6",
|
||||
"sveld": "^0.7.0",
|
||||
"sveld": "0.8.1",
|
||||
"svelte": "^3.32.1",
|
||||
"svelte-check": "^1.1.32",
|
||||
"typescript": "^4.1.3"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<script lang="ts">
|
||||
import { Breakpoint } from "../types";
|
||||
import { BreakpointSize } from "../types/Breakpoint/Breakpoint";
|
||||
|
||||
let size;
|
||||
let size: BreakpointSize;
|
||||
</script>
|
||||
|
||||
<Breakpoint
|
||||
|
|
|
@ -35,7 +35,7 @@ export function subtract(a: number, b: number) {
|
|||
hideCloseButton
|
||||
/>
|
||||
|
||||
<CodeSnippet copy="{(text) => {}}"
|
||||
<CodeSnippet copy="{(text) => text}"
|
||||
>yarn add -D carbon-components-svelte</CodeSnippet
|
||||
>
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
text="text"
|
||||
on:click
|
||||
on:copy
|
||||
copy="{(text) => {}}"
|
||||
copy="{(text) => text}"
|
||||
feedback="Copied to clipboard"
|
||||
/>
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
let storage: LocalStorage;
|
||||
let toggled = false;
|
||||
let events = [];
|
||||
|
||||
$: if (storage) storage.clearItem();
|
||||
$: if (storage) storage.clearAll();
|
||||
</script>
|
||||
|
||||
<LocalStorage
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
primaryButtonText="Confirm"
|
||||
secondaryButtons="{[{ text: 'Cancel' }, { text: 'Duplicate' }]}"
|
||||
secondaryButtonText="Cancel"
|
||||
on:click:button--secondary="{({ detail }) => (open = false)}"
|
||||
on:click:button--secondary="{({ detail }) => {
|
||||
console.log(detail);
|
||||
open = false;
|
||||
}}"
|
||||
on:open
|
||||
on:close
|
||||
on:submit
|
||||
|
|
24
types/LocalStorage/LocalStorage.d.ts
vendored
24
types/LocalStorage/LocalStorage.d.ts
vendored
|
@ -13,18 +13,6 @@ export interface LocalStorageProps {
|
|||
* @default ""
|
||||
*/
|
||||
value?: any;
|
||||
|
||||
/**
|
||||
* Remove the persisted key value from the browser's local storage
|
||||
* @default () => { localStorage.removeItem(key); }
|
||||
*/
|
||||
clearItem?: () => void;
|
||||
|
||||
/**
|
||||
* Clear all key values from the browser's local storage
|
||||
* @default () => { localStorage.clear(); }
|
||||
*/
|
||||
clearAll?: () => void;
|
||||
}
|
||||
|
||||
export default class LocalStorage extends SvelteComponentTyped<
|
||||
|
@ -34,4 +22,14 @@ export default class LocalStorage extends SvelteComponentTyped<
|
|||
update: CustomEvent<{ prevValue: any; value: any }>;
|
||||
},
|
||||
{}
|
||||
> {}
|
||||
> {
|
||||
/**
|
||||
* Remove the persisted key value from the browser's local storage
|
||||
*/
|
||||
clearItem: () => void;
|
||||
|
||||
/**
|
||||
* Clear all key values from the browser's local storage
|
||||
*/
|
||||
clearAll: () => void;
|
||||
}
|
||||
|
|
20
yarn.lock
20
yarn.lock
|
@ -2383,10 +2383,10 @@ supports-color@^7.0.0, supports-color@^7.1.0:
|
|||
dependencies:
|
||||
has-flag "^4.0.0"
|
||||
|
||||
sveld@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/sveld/-/sveld-0.7.0.tgz#379ecb92e42216cca11f7d7beecef6587c8f2b16"
|
||||
integrity sha512-M022X3vjs6EVunPSC/oubO3br8vwcBZXYTdglGrydNCSTY5JewE+tY6Y+z8TaYeFt7PtEc6uVz1vzBIUqcrpyw==
|
||||
sveld@0.8.1:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.yarnpkg.com/sveld/-/sveld-0.8.1.tgz#9fcd23efdb350500337ac1ec041647b0a8dac49d"
|
||||
integrity sha512-OtOEYDNFcjL9tmTvIJ+Iwt9nwN9NfClf5iP0bHGQRZzfSIlxY1lnl81cdMPgNz54ef5Sdibw7g4ham/MK+Spzw==
|
||||
dependencies:
|
||||
"@rollup/plugin-node-resolve" "^11.0.1"
|
||||
acorn "^8.0.4"
|
||||
|
@ -2397,6 +2397,8 @@ sveld@^0.7.0:
|
|||
rollup "^2.36.0"
|
||||
rollup-plugin-svelte "^7.0.0"
|
||||
svelte "^3.31.2"
|
||||
svelte-preprocess "^4.7.3"
|
||||
typescript "^4.1.3"
|
||||
|
||||
svelte-check@^1.1.32:
|
||||
version "1.1.32"
|
||||
|
@ -2422,6 +2424,16 @@ svelte-preprocess@^4.0.0:
|
|||
detect-indent "^6.0.0"
|
||||
strip-indent "^3.0.0"
|
||||
|
||||
svelte-preprocess@^4.7.3:
|
||||
version "4.7.4"
|
||||
resolved "https://registry.yarnpkg.com/svelte-preprocess/-/svelte-preprocess-4.7.4.tgz#e4d5208ab25c2aaaf19e837f7d7bbf7930e61d2b"
|
||||
integrity sha512-mDAmaltQl6e5zU2VEtoWEf7eLTfuOTGr9zt+BpA3AGHo8MIhKiNSPE9OLTCTOMgj0vj/uL9QBbaNmpG4G1CgIA==
|
||||
dependencies:
|
||||
"@types/pug" "^2.0.4"
|
||||
"@types/sass" "^1.16.0"
|
||||
detect-indent "^6.0.0"
|
||||
strip-indent "^3.0.0"
|
||||
|
||||
svelte@^3.31.2, svelte@^3.32.1:
|
||||
version "3.32.1"
|
||||
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.32.1.tgz#c4b6e35517d0ed77e652cc8964ef660afa2f70f3"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue