#72

Make type and interface declaration/export predicates consistent

Openfelixarntzopened 3mo ago

declareTypes, declareInterfaces, exportTypes, and exportInterfaces do not apply the type-versus-interface distinction consistently: declareTypes accepts aliases and interfaces, declareInterfaces is strict, exportTypes accepts type-only exports, and exportInterfaces may accept any type-only export or re-export without proving that it is an interface.

Relevant files:

  • packages/konsistent/src/typescript/predicates/declare-types.ts
  • packages/konsistent/src/typescript/predicates/declare-interfaces.ts
  • packages/konsistent/src/typescript/predicates/export-types.ts
  • packages/konsistent/src/typescript/predicates/export-interfaces.ts
  • packages/konsistent/src/typescript/parser.ts

Possible solutions:

  • Strictly distinguish type aliases from interfaces for both declaration and export predicates.
  • Treat “type” as an umbrella covering aliases and interfaces everywhere, then remove or deprecate the interface-specific predicates.

Backward compatibility: internal names and documentation can be renamed or removed without compatibility shims. For any konsistent.json predicate changes, keep the old predicate names and behaviors available as deprecated and emit a non-failing CLI warning whenever they are used.

Activity

0

No activity yet.