refactor(patterns): Deprecate sloppy interface guard option#2955
refactor(patterns): Deprecate sloppy interface guard option#2955
sloppy interface guard option#2955Conversation
6928018 to
ebbe21d
Compare
packages/patterns/package.json
Outdated
| ".": { | ||
| "types": "./types.d.ts", | ||
| "default": "./index.js" | ||
| }, |
There was a problem hiding this comment.
I still prefer to have an export * from './types.js' in index.js (with types.js being a stub export {})
packages/patterns/types.d.ts
Outdated
| @@ -0,0 +1,2 @@ | |||
| export * from './src/types.js'; | |||
| export * from './index.js'; | |||
There was a problem hiding this comment.
This should be removed if switching to index.js re-exporting types.js
| import { isKey, isScalarKey } from '../src/keys/checkKey.js'; | ||
| import { M } from '../src/patterns/patternMatchers.js'; | ||
| import type { Key, ScalarKey } from '../src/types.js'; | ||
| import type { Key, ScalarKey } from '../src/types.ts'; |
There was a problem hiding this comment.
FYI I prefer types tests to import from the entrypoint like a dependency would.
|
@mhofman I made your requested changes in 598ce27 but am now getting CI failures during I can't seem to find any differences in the tsconfig files of other packages that use your preferred pattern, such as Also, other packages, e.g. |
mhofman
left a comment
There was a problem hiding this comment.
I think the confusion is where a manual .d.ts / .js pair is needed, and where .ts is sufficicient.
.d.ts/ stub.jsonly for the entrypoint. No meaningful content, just.d.tsre-exporting.jsfiles, which are actually authored as.ts. There cannot be a.tsof the same name. We usually name this onetypes-index.{d.ts,js}.ts(without any.jssibling) for type definitions. It cannot contain any runtime code. The prepack step will generate a.d.tsfile (which should be equivalent to the.tsfile), and a.jsfiles (which should be empty).
Does that make sense?
mhofman
left a comment
There was a problem hiding this comment.
I have not reviewed the actual change of the types.js -> types.ts.
e8a852b to
3f20f4f
Compare
Refs: #1831, Agoric/agoric-sdk#11931
Description
We wish to visibly deprecate the
sloppyoption of@endo/patternsinterface guards. To avoid an explosion of@typedefblocks, we migrate the@endo/patternstypes to TypeScript and then add the minimally required@deprecatedtags.Security Considerations
N/A
Scaling Considerations
N/A
Documentation Considerations
N/A
Testing Considerations
This modifies the implementation of the
@endo/patternstypes, but should not modify them. Since the number of lines changed is larged, we should attempt to convince ourselves that the types are in fact the same.Compatibility Considerations
N/A
Upgrade Considerations
Deprecates but does not remove the
sloppyoption.NEWS.mdis updated.