brainy/test-strict-default.js
David Snelling 6c62bc4e9d feat: implement comprehensive type safety system with BrainyTypes API
Major enhancements for type safety and developer experience:

- Add BrainyTypes static API for type management and AI-powered suggestions
- Implement strict type validation for all 31 NounType categories
- Remove dangerous generic add() method that bypassed type safety
- Add intelligent type inference with confidence scoring
- Provide helpful error messages with typo suggestions using Levenshtein distance
- Update all internal code, examples, and documentation to use typed methods
- Enhance CLI with new type management commands (types, suggest, validate)

Breaking changes:
- Remove deprecated add() method - use addNoun() with explicit type parameter
- All addNoun() calls now require explicit type as second parameter

This release significantly improves type safety across the entire system while
maintaining backward compatibility for properly typed method calls.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 09:37:36 -07:00

20 lines
No EOL
970 B
JavaScript

// Quick test: Verify strict mode is default
import { BrainyData } from './dist/brainyData.js'
// Test 1: Default config should be strict
const brain1 = new BrainyData({})
console.log('Test 1 - Default is strict:', brain1.typeCompatibilityMode === false ? '✅ PASS' : '❌ FAIL')
// Test 2: Empty config should be strict
const brain2 = new BrainyData()
console.log('Test 2 - No config is strict:', brain2.typeCompatibilityMode === false ? '✅ PASS' : '❌ FAIL')
// Test 3: Explicit false should be strict
const brain3 = new BrainyData({ typeCompatibilityMode: false })
console.log('Test 3 - Explicit false is strict:', brain3.typeCompatibilityMode === false ? '✅ PASS' : '❌ FAIL')
// Test 4: Only true enables compatibility
const brain4 = new BrainyData({ typeCompatibilityMode: true })
console.log('Test 4 - True enables compat:', brain4.typeCompatibilityMode === true ? '✅ PASS' : '❌ FAIL')
console.log('\n✨ Summary: Strict mode is now the default!')